Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
802 views
in Technique[技术] by (71.8m points)

python - Cannot import name 'CRS' from 'pyproj' for using the osmnx library

I have used a fresh anaconda install to download and install all the required modules for osnmx library but I got the following error: enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I am the developer of OSMnx. There is a growing amount of misinformation and confusion in this thread, so I will give you a definitive answer.

Just follow the documented installation instructions to install the latest release of OSMnx:

conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx

If you install an old version of pyproj + a new version of OSMnx, or an old version of OSMnx + a new version of pyproj, you will get package conflicts such as the ImportError above. The same problems can crop up if you just conda install it or pip install it without following the documented installation instructions. Required dependency versions can be seen here. Make sure you have 64-bit python (anaconda/miniconda) installed. OSMnx is pure Python and thus its installation alone is trivial, but, it depends on geopandas which itself has tricky dependencies to install. If you follow the documented installation instructions, it should all be smooth and seamless.

To summarize:

  • do just follow the simple installation instructions in the OSMnx documentation
  • don't just run conda install osmnx
  • don't just run pip install osmnx
  • don't run pip install -U pyproj psutil
  • don't use pip at all unless you have already installed all of OSMnx's dependencies and confirmed they are all working properly (note: this is nontrivial)

If you follow the installation instructions in the documentation and still have trouble, please report what you did step by step with full details at the feedstock so we can reproduce it and quickly fix it!

Again, the installation instructions are in the documentation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...