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
583 views
in Technique[技术] by (71.8m points)

python - cannot import name Transformer from pyproj

I am trying to use Transformer from pyproj using the code below. I, however, get an error attached. What could be the issue?


ImportError                               Traceback (most recent call last)
<ipython-input-1-11c55c4b670c> in <module>
----> 1 from noiseplanet.matcher import matching
      2 import geopandas
      3 import pandas
      4 import osmnx

~Anaconda3libsite-packages
oiseplanetmatcher\__init__.py in <module>
      6 """
      7 
----> 8 from noiseplanet.matcher.model.route import graph_from_track, route_from_track
      9 from noiseplanet.matcher.matching import *
     10 from noiseplanet.matcher.datacleaner import clean_data

~Anaconda3libsite-packages
oiseplanetmatchermodel\__init__.py in <module>
      7 
      8 from noiseplanet.matcher.model.leuven import match_leuven
----> 9 from noiseplanet.matcher.model.nearest import match_nearest_edge
     10 from noiseplanet.matcher.model.route import graph_from_track, route_from_track

~Anaconda3libsite-packages
oiseplanetmatchermodel
earest.py in <module>
     14 import osmnx as ox
     15 import numpy as np
---> 16 from pyproj import Proj, Geod, Transformer
     17 
     18 # Useful script

ImportError: cannot import name 'Transformer' from 'pyproj' (C:Users
zhuwAnaconda3libsite-packagespyproj\__init__.py)


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

1 Reply

0 votes
by (71.8m points)

This issue has been solved and closed on github. When i created noiseplanet, I used pyproj==2.6.1.post1, so you should downgrade your version. It should work. You can download it with:

pip install pyproj==2.6.1.post1

This should solve your issue.

Note:

pyproj structure changed in 3.0.0, so I am guessing this is the origin of your error. Unfortunately, I am no longer working on noiseplanet. I may update the package to work with newer versions, but it takes time. Any pull requests are welcome :)

Have a great day, and happy coding !

PS: don't hesitate to open new issues, I will answer them during my free time.


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

...