I'm trying to use the graphviz Python module and I've run into this problem: I pip installed it in my command prompt, but it's not showing up in IPython. I have additionally a Python 3.5 (32-bit) interpreter where it IS showing up, but I'm trying to figure out how to have it installed so it works in IPython.
I've been recommended to include the sys.path for each of the interpreters.
Anyone have any ideas as to how I'd change it?
8 Answers
Answers 1
Try using virtual environments.
$ virtualenv -p python3 `/path/to/venv/dir` $ . `/path/to/venv/dir/bin/activate` (venv) $ # indicates virtual env is configured (venv) $ which pip python3 (venv) $ pip install whatever (venv) $ python3 script.py
Answers 2
Your system python is 3.5.2
While IPython appears to be using 3.6
based on the sys.path
output.
Try pip3.6 install graphviz
Answers 3
Try to list out installed packages in your python:
$pip freeze
Usually it happened because of PYTHONPATH problem. Did you try to reinstall your iPython? Maybe it was installed using different version of python.
$pip install ipython
I tried using Python 3.6.3, it works well.
Answers 4
You have 2 Python installations - one ordinary, as downloadable from https://www.python.org, installed in C:\Python
; and another one, the self-contained Anaconda installation C:\Users\Oliver Jr\Anaconda
.
You have installed Graphviz in the former - the standard Python distribution that resides in C:\Python
, but you've installed IPython in Anaconda!
Since I suspect that you'd much prefer Anaconda over the standard Python as it makes installing scientific and mathematical packages on Windows much easier, you'd probably want to install it in your Anaconda distribution:
conda install -c anaconda graphviz
Answers 5
It is quite common to have such cases when there are multiple installations of python.
From the snapshot, we can infer that python 3.5 is default for the system and python 3.6 is installed for the specific user (Oliver Jr).
Installing any module without setting path variable will result in installing the module in default python (python 3.5)
Inorder to use the module in python 3.6, set the path variable as
SET PATH=C:\UsersOliver Jr\Anaconda>;%PATH%;
Check if default python version is changed to python 3.6 by using
python --version
Then install the module using
pip install graphviz
You can also install using C:\UsersOliver Jr\Anaconda\bin\pip install graphviz
Answers 6
This always happens when you have multiple versions of python installed on your computer. pip
is tied to a particular version of python.
You will notice that if you run pip list --format=columns
on your shell and help('modules')
on ipython, you will see a different set of imports. This is happening because, your pip is installing for a different version of python (say 2.7) vs your ipython version (say 3.6).
To get rid of this, use virtual environments (as described above). It resolves your dependency hell and sudo issues as well.
Answers 7
Can't test it now, but what if install graphviz from IPython with "!":
! pip install graphviz
And restart IPython.
Answers 8
Try this:
conda install -c conda-forge python-graphviz
Or this: Conda comes with its own pip. Do
conda install pip
Then find the pip executable and run that directly (i.e /path/to/anacondapip install graphviz
)
0 comments:
Post a Comment