How can I use conda to install pydotplus - python

I execute the code following on my machine( Win10, python 2.7, Anaconda&Spyder) and meet ImportError: No module named pydotplus .
import networkx as nx
from networkx.drawing.nx_pydot import write_dot
G = nx.DiGraph([(1,2),(2,3),(3,2)])
write_dot(G,'file.dot')
It clearly that I should install pydotplus package. I try to conda install pydotplus directly but says Error: Package missing in current win-64 channels. Then, I google it but find there is no information about how to install it on conda. By the way, I have install pydot on conda before.
Thanks for you help in advance!

Using conda install command below worked for me (globally installed):
conda install -c conda-forge pydotplus
Using Anaconda environments (per environment instance) you can install pydotplus using pip:
pip install pydotplus
I would personally recommend using the Anaconda environments to install your packages for a given solution as its a more modular and cleaner way of building solutions with Anaconda.
Installing via Anaconda environments referenced from answer on Quora, see:
https://www.quora.com/How-do-I-install-Python-packages-in-Anaconda

I tried conda install pydotplus, but it failed.
Then tried python -m pip install pydotplus and it worked.

Try
pip install pydotplus
if it isn't part of the conda universe.

Open Anaconda prompt:
pip install pydotplus

Related

How install kmapper?

I have installed kmapper since command prompt, but when I import kmapper in jupyter notebook
is visualized a error: No module named kmapper.
What can I do?
I should install kmapper, please help me.
I don't see a Conda version for this in a major Anaconda Cloud channel. Install with pip.
conda create -n my_kmapper_env python pip numpy matplotlib scikit-learn bokeh pillow
conda activate my_kmapper_env
pip install kmapper

ImportError: cannot import name 'has_pattern' from 'gensim.utils'

I trying to import gensim.
But I got this error.
ImportError: cannot import name 'has_pattern' from 'gensim.utils' (C:\Users\admin\anaconda3\envs\tf-gpu\lib\site-packages\gensim\utils.py)
I will be grateful for any help.
Installing Version 3.4.0 solved the problem. Try the following :-
pip install gensim==3.4.0
First make sure you have gensim installed in your development environment along with its dependencies i.e. numpy, scipy and pattern:
conda install -c conda-forge gensim
conda install numpy
conda install -c anaconda scipy
conda install -c conda-forge pattern
If it's still not fixed then try updating conda:
conda update --all
also
conda update gensim
Maybe this would fix your issue!

conda environment has module installed but it does not import [duplicate]

Just installed a package through anaconda (conda install graphviz), but ipython wouldn't find it.
I can see a graphviz folder in C:\Users\username\Anaconda\pkgs
But there's nothing in: C:\Users\username\Anaconda\Lib\site-packages
The graphviz conda package is no Python package. It simply puts the graphviz files into your virtual env's Library/ directory. Look e.g. for dot.exe in the Library/bin/ directory.
To install the graphviz Python package, you can use pip:
conda install pip and pip install graphviz.
Always prefer conda packages if they are available over pip packages. Search for the package you need (conda search pkgxy) and then install it (conda install pkgxy). If it is not available, you can always build your own conda packages or you can try anaconda.org for user-built packages.
Update Nov 25, 2018: There exists now a python-graphviz package at Anaconda.org which contains the Python interface for the graphviz tool. Simply install it with conda install python-graphviz.
(Thanks to wedran and g-kaklam for posting this solution and to endolith for notifying me).
Update May 26, 2022: According to the pygraphviz website, the conda-forge channel should be used: conda install -c conda-forge pygraphviz (thanks to ian-thompson)
On conda:
First install
conda install graphviz
Then the python-library for graphviz python-graphviz
gv_python is a dynamically loaded extension for python that provides
access to the graph facilities of graphviz.
conda install python-graphviz
There is also pydot package, which can parse and dump into DOT language, used by GraphViz
conda install pydot
for me the problem was solved by installing another supportive package.
so I installed graphviz package through anaconda
then I failed to import it
after that I installed a second package named python-graphviz also through anaconda
then I succeeded in importing graphviz module into my code
I hope this will help someone :)
You can actually install both packages at the same time. For me:
conda install -c anaconda graphviz python-graphviz
did the trick.
To install graphviz,
conda install -c anaconda graphviz
pip install graphviz
If conda command not found. Follow these:
export PATH=~/anaconda/bin:$PATH
conda --version # to check your conda version
Difference between conda and pip installation,refer this stackoverflow answer
I have followed the following steps and it worked fine for me.
1 . Download and install graphviz-2.38.msi from
https://graphviz.gitlab.io/_pages/Download/Download_windows.html
2 . Set the path variable
(a) Control Panel > System and Security > System > Advanced System Settings > Environment Variables > Path > Edit
(b) add 'C:\Program Files (x86)\Graphviz2.38\bin'
Graphviz is evidently included in Anaconda so as to be used with pydot or pydot-ng (both of which are included in Anaconda). You may want to consider using one of those instead of the 'graphviz' Python module.
For ubuntu users I recommend this way:
sudo apt-get install -y graphviz libgraphviz-dev
Remeber! If you are using jupyter notebook, please restart it after the installing. That's work for me.
Because the condition before is a static variate as below:
Check if tensorflow is activated in your terminal
first deactivate it using
conda deactivate
then use the command
conda install python-graphviz
and then install
conda install graphviz
this is solution for UBUNTU USERS :) CHEERS :)
This command works officially for python:
conda install -c conda-forge python-graphviz
run this:
conda install python-graphviz
I am using anaconda for the same.
I installed graphviz using conda install graphviz in anaconda prompt.
and then installed pip install graphviz in the same command prompt. It worked for me.
I tried this way and worked for me.
conda install -c anaconda graphviz
pip install graphviz

ImportError: No module named geopandas

I just ran this code and got this error, I'm not sure why:
%matplotlib inline
​
import seaborn as sns
import pandas as pd
import pysal as ps
import geopandas as gpd
import numpy as np
import matplotlib.pyplot as pet
ImportError: No module named geopandas
Check if geopandas is installed
>>> import sys
>>> 'geopandas' in sys.modules
False => Not Installed
>>>
To install the released version, you can use pip:
pip install geopandas
or you can install the conda package from the conda-forge channel:
conda install -c conda-forge geopandas
You may install the latest development version by cloning the GitHub repository and using the setup script:
git clone https://github.com/geopandas/geopandas.git
cd geopandas
pip install .
It is also possible to install the latest development version directly from the GitHub repository with:
pip install git+git://github.com/geopandas/geopandas.git
Linux?
sudo apt-get install python-geopandas
You might encounter this problem even if geopandas is correctly installed in your active environment. Your problem might be related to ipython not being installed in the environment you installed geopandas in. In this case ipython from outside of the environment is used and will find no module named geopandas resulting in a ImportError.
Assuming a Linux OS:
You can check which ipython is used with where ipython.
You can install ìpython in your active environment by executing conda install ipython.
If using Jupyter notebook with conda use:
conda install -c conda-forge geopandas
If you have any trouble installing GeoPandas, just follow the below steps:
⦁ Go to Unofficial Windows Binaries for Python Extension Packages. (https://www.lfd.uci.edu/~gohlke/pythonlibs/)
⦁ Download the following binaries in a specifi folder in your laptop/PC:
GDAL,
Pyproj,
Fiona,
Shapely &
Geopandas
matching the version of Python, and whether the 32-bit or 64-bit OS is installed on your laptop.
(E.g. for Python v3.8x (64-bit), GDAL package should be GDAL-3.3.2-cp38-cp38-win_amd64.whl)
Go to the folder where the binaries are downloaded in the command prompt window. (C:\Users\abc\GeoPandas dependencies)
Order of execution of the following commands matter.
pip install .\GDAL-3.3.2-cp38-cp38-win_amd64.whl
pip install .\pyproj-3.2.0-cp38-cp38-win_amd64.whl
pip install .\Fiona-1.8.20-cp38-cp38-win_amd64.whl
pip install .\Shapely-1.7.1-cp38-cp38-win_amd64.whl
pip install .\geopandas-0.9.0-py3-none-any.whl
Credit
As mentioned by #marianoju, the problem is likely because you do not have IPython installed in your current environment.
The simple solution is to install IPython in your current environment.
conda install ipython
An even better solution (in my opinion) is to install Jupyter notebook, Jupyter lab in your new conda environment.
conda install jupyter
conda install jupyterlab
This will install jupyter(lab) along with its all dependencies (and that includes IPython). So, any other lurking dependency issues would have been solved in one command.

Keras: "RuntimeError: Failed to import pydot." after installing graphviz and pydot

I'm using Anaconda Python 2.7 on windows 10
I was planning on doing Keras visualization so (whilst spyder was open) I opened the Anaconda command prompt and pip installed graphviz and pydot. Now when I try run the following:
from keras.models import Sequential
or any sort of "from keras." , I get the error:
ImportError: cannot import name gof
I have uninstalled and reinstalled Keras, Graphviz and pydot. i am using the development version of theano. I cannot find a fix.
P.S
If I uninstall graphviz and pydot, keras works again
EDIT
After uninstalling anaconda and reinstalling it including theano, keras, graphviz and pydot I now get the following error:
from keras.utils.visualize_util import plot
Using Theano backend.
Using gpu device 0: GeForce GTX 970M (CNMeM is disabled, cuDNN not available)
Traceback (most recent call last):
File "<ipython-input-1-65016ddab3cd>", line 1, in <module>
from keras.utils.visualize_util import plot
File "C:\Anaconda2\lib\site-packages\keras\utils\visualize_util.py", line 8, in <module>
raise RuntimeError('Failed to import pydot. You must install pydot'
RuntimeError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.
I used pip install graphviz and pip install git+https://github.com/nlhepler/pydot.git
The error message is a bit misleading, as you can see here. The problem is that graphviz is not installed.
But you mention that graphviz was installed using pip. This is also misleading, since that graphviz package is just a python wrapper, and the graphviz binaries have to be installed separately for the python wrapper to work.
If you are using an Anaconda environment, you'd better install pydotplus and graphviz via conda install.
conda install graphviz
conda install pydotplus
Note:
You'd better update your Keras to the newest version (2.0.9+), it can automatically check and choose which one of pydotplus,pydot-ng,pydot to be used. pydot-ng has been unmaintained for a long time, and it only supports py3.4- and py2.7.
What I did is followed.
import keras
import pydotplus
from keras.utils.vis_utils import model_to_dot
keras.utils.vis_utils.pydot = pydot
plot_model(your_model_name, to_file='model.png')
That's worked for me.
On mac Anaconda python=3.6.8
Keras 2.0.6 looks for pydot-ng (better maintained) and then if it's not found, falls back on pydot. I resolved this issue by installing pydot-ng from source.
I had the same problem. I am using Anaconda python on Ubuntu. but it seems that Keras uses system's python not the Anaconda python. Initially, I installed pydot and graphviz using conda. When I installed pydot and graphviz in system's python(using /usr/bin/pip install pydot) it worked fine.
Install graphviz by brew in osx brew install graphviz, for ubuntu use apt-get install graphviz, do not need to install graphviz by pip.
I had similar problem with my Keras (without anaconda). I have solved my problem using this way
sudo pip install pydot
sudo pip install graphviz
sudo add-apt-repository ppa:gviz-adm/graphviz-dev
sudo apt-get update
sudo apt-get install graphviz-dev
1)Conda install graphviz
2)pip install graphviz
3)pip install pydot
then:
import os
os.environ["PATH"] += os.pathsep + AppData\\Local\\Continuum\\anaconda3\\envs\\tensorflow\\Library\\bin\\graphviz'
For Anaconda on Mac:
To install this package with conda run:
conda install -c anaconda graphviz
Install graphviz to the system. Download the package from here, or on Mac:
brew install graphviz
Install python pydot-ng and graphviz wrapper.
pip install pydot-ng graphviz
conda install -c anaconda pydot-ng #Anaconda user
Use pydot-ng in your code
import pydot_ng as pydot
If Keras visualization utils still uses pydot, try to change import pydot to import pydot_ng as pydot in visualize_util.py
The below works inside a jupyter notebook runing in a jupyter/tensorflow-notebook docker container.
!conda install -y graphviz pydotplus
import pydotplus
import keras.utils
keras.utils.vis_utils.pydot = pydotplus
keras.utils.plot_model(your_model_name, to_file='model.png', show_shapes=True)
You need to tell keras to use pydotplus
it is nothing related to pydot or graphviz if you have installed via pip.
You should go download graphviz brinary and install.
Don't forget adding the bin folder into your PATH: C:/Program Files (x86)/Graphviz2.38/bin/
And after that to close and reopen your console.
After installing pydot and graphviz and adding graphviz to the path, you can restart the IDE or terminal. see here.

Categories

Resources