Jupyter notebook sys.path

I'm trying to use jupyter notebook from PyCharm. 

I have a venv 'tmp' which is set as the interpreter in the project settings and there is a jupyter notebook configuration using this same venv.

When I run the jupyter notebook configuration and run the notebook in a web browser and select the 'tmp' kernel in the notebook -

```

import sys

sys.path

['',
 '/Users/asd/.virtualenvs/tmp/lib/python27.zip',
 '/Users/asd/.virtualenvs/tmp/lib/python2.7',
 '/Users/asd/.virtualenvs/tmp/lib/python2.7/plat-darwin',
 '/Users/asd/.virtualenvs/tmp/lib/python2.7/plat-mac',
 '/Users/asd/.virtualenvs/tmp/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/asd/.virtualenvs/tmp/lib/python2.7/lib-tk',
 '/Users/asd/.virtualenvs/tmp/lib/python2.7/lib-old',
 '/Users/asd/.virtualenvs/tmp/lib/python2.7/lib-dynload',
 '/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages']
```

Opening the same notebook inside Pycharm gives

sys.path
[".
'/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/usr/local/Cellar/python/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload']

Due to this kind of path I can't import packages installed in my venv in the notebook in PyCharm. What is the solution for this ?


Please sign in to leave a comment.