I am trying to install osmnx using the command
python -m pip install osmnx
but it gives the following error:
'Command "python setup.py egg_info" failed with error code 1 in C:\Users\myname\AppData\Local\Temp\pip-install-o3ha6gld\Shapely\'
For some reason you need to download the wheel for that specific module and install separately:
Install Shapely: OSError: [WinError 126] The specified module could not be found
Then OSMnx will continue to install normally
OSMnx installation instructions are provided in its documentation: https://osmnx.readthedocs.io/en/stable/
conda installation is strongly recommended to avoid issues:
conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx
Installation
You can install OSMnx with conda:
conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx
Alternatively, you can run OSMnx + Jupyter directly from the official docker container, or you can install OSMnx via pip if you already have all of its dependencies installed and tested on your system. Note: pip installation is nontrivial. If you don’t know exactly what you’re doing, just use conda as described above.
To upgrade OSMnx to a newer release, just remove the conda environment you created and then create a new one again following the steps above. Don’t just run conda update or you could get package conflicts.
Related
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
I try to install geopandas package using pip install geopandas on the Jupyter notebook. However, I get the error ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I also installed gevent using pip install gevent --pre, and my current python version is 3.8.5. However, nothing has worked yet.
I experienced the same issue when I tried to pip install geopandas. A few post recommended installation of dependencies in a precise sequence but they all failed (for me) because of fiona.
In enventually chose to install anaconda and create a virtual environment for an installation of geopandas via conda.
Create a virtual environement
conda create -n geo_env
Then activate you environement:
activate geo_env
Install Geopandas
conda install --channel conda-forge geopandas
Also, make sure to have jupyter and nb_conda_kernels plus have ipykernel.
Alternative
If you do not want to install anaconda, you could try the same procedure as above, i.e.
Create a virtual environemnt (see https://docs.python.org/3/library/venv.html)
pip install geopandas
I am trying to use osm library in Python. I found a recommended package called osmnx. I installed it via the command:
python -m pip install osmnx
when I type:
py -m pip freeze
I receive:
click==7.1.2
cycler==0.10.0
Flask==1.1.2
Flask-Ext==0.1
Flask-SQLAlchemy==2.4.4
itsdangerous==1.1.0
Jinja2==2.11.3
kiwisolver==1.3.1
MarkupSafe==1.1.1
matplotlib==3.3.4
numpy==1.20.1
osm==1.4
overpy==0.4
Pillow==8.1.0
pyparsing==2.4.7
python-dateutil==2.8.1
six==1.15.0
SQLAlchemy==1.3.23
Werkzeug==1.0.1
but osmnx is never there. Consequently when I run the code posted below, I receive the following error:
Traceback (most recent call last):
File "m:\python lessons\flask apps\osm\osmnx\test.py", line 1, in <module>
import osmnx as ox
ModuleNotFoundError: No module named 'osmnx'
Please let me know how to install osmnx in Python.
code:
import osmnx as ox
import matplotlib.pyplot as plt
place_name = "Kamppi, Helsinki, Finland"
graph = ox.graph_from_place(place_name)
Just to add to this, if you have installed osmnx using the above instructions , you will need to activate the environment each time you want to use it. To do this in anaconda prompt, type the following:
conda activate ox
This takes you from the base environment to the ox environment. You will then be able to execute the above code in anaconda prompt by typing
python myprogram.py
where myprogram.py is the name of your python program.
Older versions of osmnx installed into the base environment. However, this is not the case anymore it seems. I think there were some issues with package clashes or something.
I'm using OSMX inside of Blender which comes with its own Python distribution and Blender doesn't work well with Conda's python installs (Blender has its own python requirements). I got OSMX installed via Conda, but then Blender starting giving me all sorts of errors when using the Conda environment even following the suggestions on how to get Conda to work with Blender.
What I did is install all dependencies via pip, mindful of which version is the prereq as what is already installed may not be the version OSMX needs.
Then I installed OSMX via pip using a local wheel download from https://pypi.org/project/osmnx/#files (installing direct only had an old version and gave installation errors).
On Windows,
.\python -m pip install osmnx-1.3.0-py3-none-any.whl
After installing the pre-reqs, the wheel installed with no errors. If you have a dependency that isn't met - it will tell you and what specific version is needed.
In my case, while I had Shapely installed from another package, OSMX wanted 2.0 so I had to upgrade it using
.\python -m pip install shapely --upgrade
Hope this helps,
M
Try install with conda:
conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx
https://osmnx.readthedocs.io/en/stable/
You can find the answer in Installing OSMnx on Windows by Joshua Kobina Obeng article.
I will inlude the stesps as it is easy for you to see.
Open Anaconda command prompt(base) and type the following commands.
conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx
Then activate the enironment according to the instructions shown on the command prompt.
Open Anaconda Navigator.
In the "applications on" drop down, select "ox".
Instll Jupyter notebook by click on th install button given under "Jupyter Notebook".
After instllation complleted, launch Jupyter Notebook.
Open notebook and import osmnx.
If you want to install osnmx without conda try these steps:
From the OSMnx Github repo get the latest requirements.txt file
Install all requirements with pip command:
python3 -m pip install -r requirements.txt
Install osmnx with pip while all modules are satisfied:
python3 -m pip install osmnx
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
I need to install a version of the rdkit library released prior to 2019, when support for Python 2 was removed. This is needed to work with this library: https://github.com/brain-research/deep-molecular-massspec
I have downloaded the library from the git page, eg. https://github.com/rdkit/rdkit/releases/tag/Release_2018_09_1, and tried using pip to install from that.
sudo pip install rdkit-Release_2018_09_1b1.tar.gz
I get the following error:
Processing ./rdkit-Release_2018_09_1b1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
IOError: [Errno 2] No such file or directory: '/tmp/pip-ohIcaj-build/setup.py'
---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-ohIcaj-build
I have tried installing the specific version using pip too:
sudo pip install rdkit==2018.09.01
Which gives:
Collecting rdkit==2018.09.01 Could not find a version that satisfies
the requirement rdkit==2018.09.01 (from versions: ) No matching
distribution found for rdkit==2018.09.01
Can someone tell me how to do this?
#paisanco is correct, attempting to install rdkit with pip will not work. The easiest way to install rdkit is by using Anaconda unless you want to build from source.
If you have Anaconda installed you can create a python 2.7 virtual environment:
conda create --name test-env python=2.7
You can then activate it:
conda activate test-env
And then install the rdkit version you require:
conda install -c rdkit rdkit=2018.09.1
Using Python:
import rdkit
print rdkit.__version__
[Out]: '2018.09.1'
Create a new conda environment with python 2.7.15:
conda create -n py27_rdkit python=2.7.15 ipython
Activate environment (python2.7)
conda activate py27_rdkit
Now in the py27_protac environment, install older version of rdkit that won't gripe about python2.7:
conda install -c conda-forge rdkit rdkit=2018.09.1
The conda install command in answer above: 'conda install -c rdkit rdkit=2018.09.1' failed due numerous conflicts.
The problem is what you downloaded, according to that site, is a tar archive containing the source code for that library, not a pip package.
So attempting to install it using pip will not work.
The RDKit project home page gives other options for installing 1) from within an Anaconda conda virtual environment 2) from the source code (what you downloaded) for Windows, Linux, and Mac.
Those instructions are at RDKit installation instructions
conda create -n my_env python=3.7
conda activate my_env
conda install numpy matplotlib
conda install cmake cairo pillow eigen pkg-config
conda install boost-cpp boost py-boost
and download rdkit package https://anaconda.org/rdkit/rdkit/files
# finally
conda install rdkit-2020.09.1b1.0-py37hd50e099_1.tar.bz2