Jupyter Notebook import not working after recent update - matplotlib

I recently used the following command to update my jupyter packages conda update --all and from then on my visualization libraries wont import(matplotlib and seaborn). I used conda install <pkg> even then it wouldnt. So I reinstalled anaconda3 but same problem persists...
I tried to view sys.executable and found that it was not referencing my python lib in anaconda but in python click here
'c:\\python38\\python.exe' So i used pip3 install matplotlib and matplotlib worked. I want my jupyter to reference to its own lib stack as I cannot install all libraries in python. I want the jupyter to read packages from this path : C:\Users\princ\anaconda3\Lib\site-packages because all anaconda libraries are there. How do I do it? Help me please. The problem is jupyter is referencing python package folder and not pre installed packages in anaconda
SYS.PATH:
'c:\\python38\\python38.zip',
'c:\\python38\\DLLs',
'c:\\python38\\lib',
'c:\\python38',
'',
'C:\\Users\\princ\\AppData\\Roaming\\Python\\Python38\\site-packages',
'c:\\python38\\lib\\site-packages',
'c:\\python38\\lib\\site-packages\\win32',
'c:\\python38\\lib\\site-packages\\win32\\lib',
'c:\\python38\\lib\\site-packages\\Pythonwin',
'c:\\python38\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\princ\\.ipython']
jupyter kernelspec list
python3 c:\python38\share\jupyter\kernels\python3

Did you tried running pip using directly the python executable with
python.exe -m pip install <pkg>
I don't know if there is a similar way to do it with conda

Related

Importing cx_Oracle in Jupyter note book gives ModuleNotFoundError

i am using jupyter notebook and i am trying to do sql queries in jupyter book
but i got an error
To install cx_Oracle latest version 8.0.0 in your own laptop, you need the following components already installed:
Python 3x
An Oracle Instant Client version 11g or higher. Refer to download the instant client version to this link
https://www.oracle.com/database/technologies/instant-client/downloads.html
Steps to Download and Install cx_Oracle Package for Python on Windows. In my case, I like better the version available in GitHub
https://github.com/oracle/python-cx_Oracle
1.Click on the Download cx_Oracle link to download the package from Github. It will download a zip file into your laptop.
2.Extract the zip file to a folder on Windows. For example, C:\cx_oracle.
3.Now open the command prompt and change the current directory to the C:\cx_oracle directory to install cx_Oracle package.
4.Then run the following command.
python -m pip install cx_Oracle --upgrade pip
It will install the cx_Oracle package for Python on Windows, and you will get the messages as shown below.
Collecting pip
Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (1.3MB)
100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 1.3MB 2.5MB/s
Installing collected packages: pip
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Successfully uninstalled pip-10.0.1
Successfully installed pip-18.0
Important if you have more than one version of Python, use the one associated to Jupyter notebook.
You need to import the package first:
pip install cx-Oracle
In simple words for anaconda users
while installing the package use small case letters source
conda install -c conda-forge cx_oracle
now while importing the package use init cap as
import cx_Oracle

Installing pandas without pip

Is it possible to install pandas without installing pip or Is there any other way to use pandas without installing pip.
Thanks in advance.
pip is a package management system used to install and manage software packages written in Python. Many packages can be found in the default source for packages and their dependencies
here is the another way:
Download and unzip the current pandapower distribution to your local hard drive.
Open a command prompt (e.g. Start–>cmd on Windows) and navigate to the folder that contains the setup.py file with the command cd
cd %path_to_pandapower%\pandapower-x.x.x\
Install pandapower by running
python setup.py install
You can get pandas installed using the Anaconda distribution, which includes the Anaconda prompt. After you open an anaconda prompt, you can run the following command:
conda install pandas
which will install the latest version of pandas, or:
conda install pandas=0.20.3
to get a specific version of the package. Another way to do it is to install it with Miniconda, which allows you to avoid downloading the Anaconda installer and hundreds of other packages. More information can be found here: https://pandas.pydata.org/pandas-docs/version/0.23.4/install.html

Tensorflow version different in conda env & jupyter notebook

I created a conda env and installed tensorflow 1.4
pip install tensorflow==1.4
This installed, and from within the environment, when i type
import tensorflow as tf
tf.__version__
it prints '1.4.0'
Now, i open jupyter notebook from the same environment, and when i type the same in the notebook, it gives me 1.10.0
How is this possible? Jupyter notebook should take the same libraries within which it is running. How does it have a different version of tensorflow
And btw I'm concerned with this because i wanna use 1.4.0 in my notebook
These are the questions I ask myself in situations like this, and they usually resolve my issue:
Was the kernel of my notebook running while I pipped? Shut down and restart.
Are pip and conda sharing PATH, et cetera? I don't take it for granted that my pip is modifying my conda env. You can check with these commands.
Your conda env is created, but is it active? You list created envs with these, and you can activate/deactivate with these.
Besides checking all of these, where am I launching jupyter from? I like to install jupyter with a simply pip install jupyter and that could add jupyter to the command line globally. Anaconda navigator/command line reliably launches the jupyter that lives in your Anaconda distribution.
To add to Charles Landau:
You likely installed tensorflow in parallel with pip and with conda.
Within your env, just check with pip list tensorflow and conda list tensorflow. Most likely you will see two different versions.
To be consistent do:
pip unistall tensorflow to keep only one.

Can't download numpy and tensorflow to python 3.5

I have been trying to download tensorflow, and numpy so that they will work when I run them in python 3.5 idle ( the newest model that tensorflow seems to work with). I have both python 3.6 and 3.5 downloaded and I can't seem to make anything that I download( numpy so far) apply to anything but 3.6. I'm not sure if this has something to do with the path that I am calling them through command line, but I was wondering if there was an answer to this situation.
1] Using pip package manager
Use pip to install numpy for you : pip install numpy
If you do not have pip you can install it by following command : python get-pip.py
Use pip to install tensorflow for you: pip install tensorflow
2] Using Anaconda or Miniconda (RECOMMENDED)
Install Anaconda or Miniconda
conda is the package manager for Anaconda and Miniconda
Open the Conda prompt
Anaconda comes with numpy package so no need to explicitly install numpy
In case if you have downloaded Miniconda then you have to install numpy I guess. Run the following command to install numpy : conda install numpy
Run the following command to install tensorflow :conda install -c conda-forge tensorflow or simply conda install tensorflow
Anaconda also comes with it's own pip. You can use Anaconda's pip to install tensorflow by running pip install tensorflow
===========================================================================
By any chance if you get an error in the terminal saying that "command" is not recognized as an internal or external command which means you have not specified the absolute path of pip or python or conda
One solution to the above error can be to add the path of python, pip and anaconda as an environmental variable if you are on windows
If you are on Linux you can add the path of python, pip and anaconda to the PATH variable by export PATH=$PATH:/path/to/dir

ImportError: Missing required dependencies ['numpy'] from Pandas Created Conda Environment

I created a new conda environment as follows
conda create -n NAME python=3.5
Added edit, of course activate the environment like so
activate NAME
Installed these libraries all at once
conda install numpy scipy pandas scikit-learn jupyter matplotlib
relevant libary versions that conda installed
when importing pandas ge
ImportError: Missing required dependencies ['numpy']
Can anyone replicate this installation of env on windows? I am thinking one of the files version are causing this and cannot find a solution, barring an externality.
Have uninstalled and installed pandas, numpy, etc all libraries, have also tried installing with pip even, nothing is working. Have even created another environment from scratch same error is occurring.
Conda should have installed a number of libraries when you build python 3.5 in the new environment. If you run "conda list" in the command line of the newly built environment it will show the packages you have by default. Try to build the environment with "conda create -n py35 python=3.5 anaconda" so it uses the anaconda python and will auto install packages.