Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jupyter finds wrong python binary with conda #134

Open
parsifal9 opened this issue Jun 27, 2018 · 1 comment
Open

jupyter finds wrong python binary with conda #134

parsifal9 opened this issue Jun 27, 2018 · 1 comment

Comments

@parsifal9
Copy link

Hi All,
I am having a problem with jupyter finding the wrong version of python.
But first

  1. is this the right forum for this sort of problem?
  2. I don't see a list of details to include in a report. Have I included useful info?

My set-up is

bash Anaconda3-5.1.0-Linux-x86_64.sh
conda env create --file environment.yml
source activate placer-env
conda install nb_conda

and anaconda is installed in /home/dun280/local/anaconda3/

I have been trying to get this to work with elpy mode in emacs. But now I have realized that the problem is something to do with jupyter's paths. The following code snippet shows the problem. In the virtual env, I can see the right jupyter and python but when I start "jupyter console" it picks up the wrong python.

tamar: echo $PATH
/home/dun280/local/anaconda3/bin:/home/dun280/local/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

tamar: which jupyter
/home/dun280/local/anaconda3/bin/jupyter
tamar: which python
/home/dun280/local/anaconda3/bin/python
tamar: python --version
Python 3.6.4 :: Anaconda, Inc.

tamar: source activate placer-env

(placer-env) tamar:  echo $PATH
/home/dun280/local/anaconda3/envs/placer-env/bin:/home/dun280/local/anaconda3/bin:/home/dun280/local/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

(placer-env) tamar: which jupyter
/home/dun280/local/anaconda3/envs/placer-env/bin/jupyter
(placer-env) tamar: jupyter --version
4.4.0

(placer-env) tamar: which python
/home/dun280/local/anaconda3/envs/placer-env/bin/python
(placer-env) tamar: python --version
Python 3.6.5

(placer-env) tamar: jupyter kernelspec list
Available kernels:
python3    /home/dun280/local/anaconda3/envs/placer-env/share/jupyter/kernels/python3

(placer-env) tamar: jupyter console
Jupyter console 5.2.0
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

See -- "jupyter console" has found Python 3.6.4, so I can't load all of the modules I have installed in the virtual env.

Bye

@parsifal9
Copy link
Author

Hi All,

I have updated conda to see if that fixes the problem

conda update -n root conda
conda update --all

Now /home/dun280/local/anaconda3/bin has a python 3.6.5 binary

/home/dun280/Dropbox/learning/python-anaconda/placer/placer/Feature extraction
tamar:  echo $PATH
/home/dun280/local/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
tamar: which jupyter
/home/dun280/local/anaconda3/bin/jupyter
tamar: which python
/home/dun280/local/anaconda3/bin/python
tamar: python --version
Python 3.6.5
tamar: source activate placer-env
(placer-env) tamar:  echo $PATH
/home/dun280/local/anaconda3/envs/placer-env/bin:/home/dun280/local/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
(placer-env) tamar: which jupyter
/home/dun280/local/anaconda3/envs/placer-env/bin/jupyter
(placer-env) tamar: which python
/home/dun280/local/anaconda3/envs/placer-env/bin/python
(placer-env) tamar: python --version
Python 3.6.5
(placer-env) tamar: jupyter kernelspec list
Available kernels:
  python3    /home/dun280/local/anaconda3/envs/placer-env/share/jupyter/kernels/python3
(placer-env) tamar: jupyter console
Jupyter console 5.2.0
Python 3.6.5 | packaged by conda-forge | (default, Apr  6 2018, 13:39:56) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import pandas as pd
In [2]: import fiona, fiona.crs
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-c04c0287504e> in <module>()
----> 1 import fiona, fiona.crs

ModuleNotFoundError: No module named 'fiona'

Now jupyter finds a "Python 3.6.5" but it is still the wrong python -- it does not find the modules
installed in the virtual environment. However, if I just start python

(placer-env) tamar: python
Python 3.6.5 | packaged by conda-forge | (default, Apr  6 2018, 13:39:56) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> import fiona, fiona.crs
>>> 

it can find them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant