Problem with pip install
When I try to install the package with pip in SO Windows, I get the followingoutput.
Can anyone help me?
(geo_env) PS C:\Users\profr> pip install geobr
Collecting geobr
Using cached geobr-0.2.0-py2.py3-none-any.whl (34 kB)
Collecting geopandas<0.8.0,>=0.7.0 (from geobr)
Using cached geopandas-0.7.0-py2.py3-none-any.whl (928 kB)
Collecting shapely<2.0.0,>=1.7.0 (from geobr)
Using cached Shapely-1.8.5.post1.tar.gz (200 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
Traceback (most recent call last):
File "C:\Users\profr\anaconda3\envs\geo_env\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
main()
File "C:\Users\profr\anaconda3\envs\geo_env\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\profr\anaconda3\envs\geo_env\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 112, in get_requires_for_build_wheel
backend = _build_backend()
^^^^^^^^^^^^^^^^
File "C:\Users\profr\anaconda3\envs\geo_env\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\profr\anaconda3\envs\geo_env\Lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 994, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "C:\Users\profr\AppData\Local\Temp\pip-build-env-c2699h3v\overlay\Lib\site-packages\setuptools\__init__.py", line 16, in <module>
import setuptools.version
File "C:\Users\profr\AppData\Local\Temp\pip-build-env-c2699h3v\overlay\Lib\site-packages\setuptools\version.py", line 1, in <module>
import pkg_resources
File "C:\Users\profr\AppData\Local\Temp\pip-build-env-c2699h3v\overlay\Lib\site-packages\pkg_resources\__init__.py", line 2191, in <module>
register_finder(pkgutil.ImpImporter, find_on_path)
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
@BAFurtado , could you please have a quick look at this?
There's probably a version incompatibility. I would try a new env from scratch including at once all necessary packages.
Something like:
conda create -n my_new_env geobr ... geoandas... shapely ... whatever
Do not state specific version numbers and let conda decide on the latest possible.
Or the equivalent in pip.
Specifically, shapely, gdal and geopandas are tricky to install. So the best way is to do it together using conda
Other pythonists nowadays use poetryand other env managers. Conda has worked fine for me.
The error you're encountering seems to be related to a compatibility or dependency issue. I just installed geobr without any problem. You might want to try creating a new environment to test it. This approach often resolves conflicts and issues related to specific package installations.
I tried it a few times, but the problem still persists in Win11.
This seems to be an issue in your pip version. Due to the removal of the long-deprecated pkgutil.ImpImporter class, the pip command may not work for Python 3.12 or newer versions.
To fix this issue you can follow this steps:
- Download the package https://pypi.org/project/geobr/#files;
- Unzip it;
cdinto the package directory;- type
python setup.py installfor windows orsudo python setup.py installfor ubuntu; note: you may need administrator privileges for the 4th step
Please try this solution and tell me how it goes : )
I just updated the package dependencies (PR #341).
All issues related to dependencies and installation should be solved with it.
Try pip install geobr -U to try the new version and let me know how it goes.
I have the same problem when installing on mac. AttributeError: module 'pkgutil' does not have attribute 'ImpImporter'.
I have already created a new venv and also tried to do as suggested by Lucas-Pavesys, both without success.
Any suggestions on what I can do?
Hello, I managed to solve it. Apparently everything is working fine here. I installed geopanda with python 3.9.19 in a new env. And when I tried to install geobr, pip solved it without any problems. Maybe it's the version of python 3.12 that is causing incompatibility. If it works, I'll leave the commands I used.
conda create -n geo_env
conda activate geo_env
conda config --env --add channels conda-forge
conda config --env --set channel_priority strict
conda install python=3.9.19 geopandas
pip install geobr