conda-forge / osmnx-feedstock

A conda-smithy repository for osmnx.
BSD 3-Clause "New" or "Revised" License
8 stars 10 forks source link

Python >= 3.9 and Networkx >= 2.5 compatability #78

Closed TyceHerrman closed 3 years ago

TyceHerrman commented 3 years ago

Issue: In Python 3.9.2 environment with Networkx 2.5.1 installed, encountering the following error upon importing osmnx: ImportError: cannot import name 'empty_generator' from 'networkx.utils'. Seems to be an issue with Python >= 3.9 and >= Networkx 2.5 https://github.com/smicallef/spiderfoot/issues/1124

Windows 10 and osmnx 1.0.1


Environment (conda list):

``` $ conda list Name Version Build Channel argon2-cffi 20.1.0 py39hb82d6ee_2 conda-forge async_generator 1.10 py_0 conda-forge attrs 20.3.0 pyhd3deb0d_0 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 py_2 conda-forge backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge bleach 3.3.0 pyh44b312d_0 conda-forge boost-cpp 1.74.0 h54f0996_2 conda-forge branca 0.4.2 pyhd8ed1ab_0 conda-forge brotlipy 0.7.0 py39hb82d6ee_1001 conda-forge bzip2 1.0.8 h8ffe710_4 conda-forge ca-certificates 2020.12.5 h5b45459_0 conda-forge cairo 1.16.0 hb19e0ff_1008 conda-forge certifi 2020.12.5 py39hcbf5309_1 conda-forge cffi 1.14.5 py39h0878f49_0 conda-forge cfitsio 3.470 h0af3d06_7 conda-forge chardet 4.0.0 py39hcbf5309_1 conda-forge click 7.1.2 pyh9f0ad1d_0 conda-forge click-plugins 1.1.1 py_0 conda-forge cligj 0.7.1 pyhd8ed1ab_0 conda-forge colorama 0.4.4 pyh9f0ad1d_0 conda-forge cryptography 3.4.7 py39hd8d06c1_0 conda-forge curl 7.76.0 hf1763fc_0 conda-forge cycler 0.10.0 py_2 conda-forge decorator 4.4.2 py_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge descartes 1.1.0 py_4 conda-forge entrypoints 0.3 pyhd8ed1ab_1003 conda-forge expat 2.3.0 h39d44d4_0 conda-forge fiona 1.8.19 py39h9f1b043_0 conda-forge folium 0.12.0 pyhd8ed1ab_1 conda-forge fontconfig 2.13.1 h1989441_1005 conda-forge freetype 2.10.4 h546665d_1 conda-forge freexl 1.0.6 ha8e266a_0 conda-forge gdal 3.2.2 py39h6795fcd_2 conda-forge geopandas 0.9.0 pyhd8ed1ab_0 conda-forge geos 3.9.1 h39d44d4_2 conda-forge geotiff 1.6.0 h8e90983_5 conda-forge gettext 0.19.8.1 h1a89ca6_1005 conda-forge hdf4 4.2.13 h0e5069d_1004 conda-forge hdf5 1.10.6 nompi_h5268f04_1114 conda-forge icu 68.1 h0e60522_0 conda-forge idna 2.10 pyh9f0ad1d_0 conda-forge importlib-metadata 3.10.0 py39hcbf5309_0 conda-forge intel-openmp 2021.2.0 h57928b3_616 conda-forge ipykernel 5.5.3 py39h832f523_0 conda-forge ipython 7.22.0 py39h832f523_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge ipywidgets 7.6.3 pyhd3deb0d_0 conda-forge jedi 0.18.0 py39hcbf5309_2 conda-forge jinja2 2.11.3 pyh44b312d_0 conda-forge joblib 1.0.1 pyhd8ed1ab_0 conda-forge jpeg 9d h8ffe710_0 conda-forge jsonschema 3.2.0 pyhd8ed1ab_3 conda-forge jupyter 1.0.0 py39hcbf5309_6 conda-forge jupyter_client 6.1.12 pyhd8ed1ab_0 conda-forge jupyter_console 6.4.0 pyhd8ed1ab_0 conda-forge jupyter_core 4.7.1 py39hcbf5309_0 conda-forge jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge jupyterlab_widgets 1.0.0 pyhd8ed1ab_1 conda-forge kealib 1.4.14 h96bfa42_2 conda-forge kiwisolver 1.3.1 py39h2e07f2f_1 conda-forge krb5 1.17.2 hbae68bd_0 conda-forge lcms2 2.12 h2a16943_0 conda-forge libblas 3.9.0 8_mkl conda-forge libcblas 3.9.0 8_mkl conda-forge libclang 11.1.0 default_h5c34c98_0 conda-forge libcurl 7.76.0 hf1763fc_0 conda-forge libffi 3.3 h0e60522_2 conda-forge libgdal 3.2.2 h48ef39c_2 conda-forge libglib 2.68.1 h1e62bf3_0 conda-forge libiconv 1.16 he774522_0 conda-forge libkml 1.3.0 h9859afa_1013 conda-forge liblapack 3.9.0 8_mkl conda-forge libnetcdf 4.7.4 nompi_h3a9aa94_107 conda-forge libpng 1.6.37 h1d00b33_2 conda-forge libpq 13.1 h4f54205_2 conda-forge librttopo 1.1.0 hb340de5_6 conda-forge libsodium 1.0.18 h8d14728_1 conda-forge libspatialindex 1.9.3 h39d44d4_3 conda-forge libspatialite 5.0.1 h6b539a6_4 conda-forge libssh2 1.9.0 h680486a_6 conda-forge libtiff 4.2.0 hc10be44_0 conda-forge libwebp-base 1.2.0 h8ffe710_2 conda-forge libxml2 2.9.10 hf5bbc77_3 conda-forge lz4-c 1.9.3 h8ffe710_0 conda-forge m2w64-gcc-libgfortran 5.3.0 6 conda-forge m2w64-gcc-libs 5.3.0 7 conda-forge m2w64-gcc-libs-core 5.3.0 7 conda-forge m2w64-gmp 6.1.0 2 conda-forge m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge markupsafe 1.1.1 py39hb82d6ee_3 conda-forge matplotlib-base 3.4.1 py39h581301d_0 conda-forge mistune 0.8.4 py39hb82d6ee_1003 conda-forge mkl 2020.4 hb70f87d_311 conda-forge msys2-conda-epoch 20160418 1 conda-forge munch 2.5.0 py_0 conda-forge nbclient 0.5.3 pyhd8ed1ab_0 conda-forge nbconvert 6.0.7 py39hcbf5309_3 conda-forge nbformat 5.1.3 pyhd8ed1ab_0 conda-forge nest-asyncio 1.5.1 pyhd8ed1ab_0 conda-forge networkx 2.5.1 pyhd8ed1ab_0 conda-forge notebook 6.3.0 py39hcbf5309_0 conda-forge numpy 1.20.2 py39h6635163_0 conda-forge olefile 0.46 pyh9f0ad1d_1 conda-forge openjpeg 2.4.0 h48faf41_0 conda-forge openssl 1.1.1k h8ffe710_0 conda-forge osmnx 1.0.1 pyhd3deb0d_0 conda-forge packaging 20.9 pyh44b312d_0 conda-forge pandas 1.2.3 py39h2e25243_0 conda-forge pandoc 2.13 h8ffe710_0 conda-forge pandocfilters 1.4.2 py_1 conda-forge parso 0.8.2 pyhd8ed1ab_0 conda-forge pcre 8.44 ha925a31_0 conda-forge pickleshare 0.7.5 py_1003 conda-forge pillow 8.1.2 py39h1a9d4f7_1 conda-forge pip 21.0.1 pyhd8ed1ab_0 conda-forge pixman 0.40.0 h8ffe710_0 conda-forge poppler 21.03.0 h9ff6ed8_0 conda-forge poppler-data 0.4.10 0 conda-forge postgresql 13.1 h0f1a9bc_2 conda-forge proj 8.0.0 h1cfcee9_0 conda-forge prometheus_client 0.10.1 pyhd8ed1ab_0 conda-forge prompt-toolkit 3.0.18 pyha770c72_0 conda-forge prompt_toolkit 3.0.18 hd8ed1ab_0 conda-forge pycparser 2.20 pyh9f0ad1d_2 conda-forge pygments 2.8.1 pyhd8ed1ab_0 conda-forge pyopenssl 20.0.1 pyhd8ed1ab_0 conda-forge pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge pyproj 3.0.1 py39h1007a03_1 conda-forge pyqt 5.12.3 py39hcbf5309_7 conda-forge pyqt-impl 5.12.3 py39h415ef7b_7 conda-forge pyqt5-sip 4.19.18 py39h415ef7b_7 conda-forge pyqtchart 5.12 py39h415ef7b_7 conda-forge pyqtwebengine 5.12.1 py39h415ef7b_7 conda-forge pyrsistent 0.17.3 py39hb82d6ee_2 conda-forge pysocks 1.7.1 py39hcbf5309_3 conda-forge python 3.9.2 h7840368_0_cpython conda-forge python-dateutil 2.8.1 py_0 conda-forge python_abi 3.9 1_cp39 conda-forge pytz 2021.1 pyhd8ed1ab_0 conda-forge pywin32 300 py39hb82d6ee_0 conda-forge pywinpty 0.5.7 py39hde42818_1 conda-forge pyzmq 22.0.3 py39he46f08e_1 conda-forge qt 5.12.9 h5909a2a_4 conda-forge qtconsole 5.0.3 pyhd8ed1ab_0 conda-forge qtpy 1.9.0 py_0 conda-forge requests 2.25.1 pyhd3deb0d_0 conda-forge rtree 0.9.7 py39h09fdee3_1 conda-forge scikit-learn 0.24.1 py39he931e04_0 conda-forge scipy 1.6.2 py39hc0c34ad_0 conda-forge send2trash 1.5.0 py_0 conda-forge setuptools 49.6.0 py39hcbf5309_3 conda-forge shapely 1.7.1 py39h90c6b7e_4 conda-forge six 1.15.0 pyh9f0ad1d_0 conda-forge sqlite 3.35.4 h8ffe710_0 conda-forge terminado 0.9.4 py39hcbf5309_0 conda-forge testpath 0.4.4 py_0 conda-forge threadpoolctl 2.1.0 pyh5ca1d4c_0 conda-forge tiledb 2.2.7 hf84e3da_0 conda-forge tk 8.6.10 h8ffe710_1 conda-forge tornado 6.1 py39hb82d6ee_1 conda-forge traitlets 5.0.5 py_0 conda-forge tzdata 2021a he74cb21_0 conda-forge urllib3 1.26.4 pyhd8ed1ab_0 conda-forge vc 14.2 hb210afc_4 conda-forge vs2015_runtime 14.28.29325 h5e1d092_4 conda-forge wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.36.2 pyhd3deb0d_0 conda-forge widgetsnbextension 3.5.1 py39hcbf5309_4 conda-forge win_inet_pton 1.1.0 py39hcbf5309_2 conda-forge wincertstore 0.2 py39hcbf5309_1006 conda-forge winpty 0.4.3 4 conda-forge xerces-c 3.2.3 h0e60522_2 conda-forge xz 5.2.5 h62dcd97_1 conda-forge zeromq 4.3.4 h0e60522_0 conda-forge zipp 3.4.1 pyhd8ed1ab_0 conda-forge zlib 1.2.11 h62dcd97_1010 conda-forge zstd 1.4.9 h6255e5f_0 conda-forge ```


Details about conda and system ( conda info ):

``` $ conda info active environment : nysdotwz active env location : C:\Users\Tyce Herrman\miniconda3\envs\nysdotwz shell level : 2 user config file : C:\Users\Tyce Herrman\.condarc populated config files : C:\Users\Tyce Herrman\.condarc conda version : 4.10.0 conda-build version : not installed python version : 3.9.1.final.0 virtual packages : __cuda=11.1=0 __win=0=0 __archspec=1=x86_64 base environment : C:\Users\Tyce Herrman\miniconda3 (writable) conda av data dir : C:\Users\Tyce Herrman\miniconda3\etc\conda conda av metadata url : https://repo.anaconda.com/pkgs/main channel URLs : https://conda.anaconda.org/conda-forge/win-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : C:\Users\Tyce Herrman\miniconda3\pkgs C:\Users\Tyce Herrman\.conda\pkgs C:\Users\Tyce Herrman\AppData\Local\conda\conda\pkgs envs directories : C:\Users\Tyce Herrman\miniconda3\envs C:\Users\Tyce Herrman\.conda\envs C:\Users\Tyce Herrman\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/4.10.0 requests/2.25.1 CPython/3.9.1 Windows/10 Windows/10.0.19041 administrator : False netrc file : None offline mode : False ```
gboeing commented 3 years ago

Is this an OSMnx issue or a NetworkX issue?

gboeing commented 3 years ago

I'm not able to reproduce this (on Linux). I just created a virtual environment with python 3.9.2, NetworkX 2.5.1, and OSMnx 1.0.1, and I am able to import OSMnx without error.

Can you provide any further details about how exactly you created your environment? Can you give us step-by-step directions to install and reproduce?

raha1986 commented 3 years ago

I have python3.9 and try installed networkx2.5.1, and I get the import error ImportError: cannot import name 'empty_generator' from 'networkx.utils' (C:\Users\azam.bahrehdar1\Anaconda3\envs\geo_env\lib\site-packages\networkx\utils\__init__.py)

Can anyone help that why it is happening?

gboeing commented 3 years ago

@raha1986 my best guess is that this sounds like a NetworkX issue: best to open at NetworkX feedstock or at NetworkX repo. Like I mentioned in the comment above:

I'm not able to reproduce this (on Linux). I just created a virtual environment with python 3.9.2, NetworkX 2.5.1, and OSMnx 1.0.1, and I am able to import OSMnx without error.

Can you provide any further details about how exactly you created your environment? Can you give us step-by-step directions to install and reproduce?

bmitrauncc commented 2 years ago

Having the same issue, unable to find a solution for this...

gboeing commented 2 years ago

@bmitrauncc what versions of Python, NetworkX, and OSMnx are you using? And what OS do you have? How did you install OSMnx? We need more troubleshooting details.

PhilippEberl commented 2 years ago

Having a similar issue: ImportError: cannot import name 'argmap' from 'networkx.utils.decorators' (/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/networkx/utils/decorators.py)- Running on Python 3.9 and Networkx on 2.8

jogugil commented 2 years ago

I have the same problem. What has been the solution? my versions are networkxy 2.8 and Python 3.9.7 ImportError: cannot import name 'argmap' from 'networkx.utils.decorators' (D:\anaconda\envs\NLP\lib\site-packages\networkx\utils\decorators.py)

gboeing commented 2 years ago

Like I mentioned in an earlier comment, we need more troubleshooting details to be able to reproduce this. At a minimum:

  1. what versions of Python, NetworkX, and OSMnx are you using?
  2. what OS do you have?
  3. precisely how did you install OSMnx?

The third point is all important here and we cannot troubleshoot without it. FWIW, I am currently running Python 3.9.12, OSMnx 1.1.2, and NetworkX 2.8 on my local Windows, Mac, and Ubuntu machines without trouble. Please confirm you are following the documented installation instructions.

jogugil commented 2 years ago

what versions of Python , NetworkX, and OSMnx are you using? Python 3.9.7 NetworkX 2.8,
what OS do you have? Windows 11

OSMnx was not properly updated. Thanks in advance. I think all evil comes from Windows 11 but don't pay much attention to me ;-)

wasim2020 commented 2 years ago

I have the same problem, can anyone tell me how to solve please ?

ImportError: cannot import name 'argmap' from 'networkx.utils.decorators' (C:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\networkx\utils\decorators.py)

jogugil commented 2 years ago

with patience and updating to the latest networkx, spaci, and related versions... I think conda install -U ... updates all dependencies. Then jupiter sla and turn off anaconda. If you have windows 11 like me, you will have to go to the task control window and manually kill all active browser processes (chorme,...) the one you use. and if you have python processes as was my case, too... go back into anaconda/jupiter and run your code..... tell me... a hello

wasim2020 commented 2 years ago

with patience and updating to the latest networkx, spaci, and related versions... I think conda install -U ... updates all dependencies. Then jupiter sla and turn off anaconda. If you have windows 11 like me, you will have to go to the task control window and manually kill all active browser processes (chorme,...) the one you use. and if you have python processes as was my case, too... go back into anaconda/jupiter and run your code..... tell me... a hello

Thank you dear, I installed networks 2.5.1 and it works fine now.

sponline2001 commented 1 year ago

cannot import name 'from_numpy_matrix' from 'networkx' (/usr/local/lib/python3.9/dist-packages/networkx/init.py)

any idea?

sandyavs commented 1 year ago

I do have the same problem as @sponline2001. Any solutions are appreciated.

gboeing commented 1 year ago

See my previous comment in this thread. No one can help without those troubleshooting details.