Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. while installing pip install keplergl

After installing shapely/gdal/fiona, I use pip install keplergl in jupyter notebook, the error shows

    ERROR: Command errored out with exit status 1:
     command: 'D:\Anaconda\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\hyq94\\AppData\\Local\\Temp\\pip-install-bn96hrfp\\fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\hyq94\\AppData\\Local\\Temp\\pip-install-bn96hrfp\\fiona\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: C:\Users\hyq94\AppData\Local\Temp\pip-install-bn96hrfp\fiona\
    Complete output (1 lines):
    A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I have tried conda remove gdal and conda install geopandas, and uninstall and refresh package, but it doesn't work.

Is there any solution? Please help me with this problem : )

like image 688
Blanche Huang Avatar asked Dec 08 '19 04:12

Blanche Huang


1 Answers

When trying to install this I got the same error. My full error was:

ERROR: Command errored out with exit status 1:
     command: 'c:\users\tom\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-gksasqz1\\fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-gksasqz1\\fiona\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\tom\AppData\Local\Temp\pip-install-gksasqz1\fiona\pip-egg-info'
         cwd: C:\Users\tom\AppData\Local\Temp\pip-install-gksasqz1\fiona\
    Complete output (1 lines):
    A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Here if you look closely you can see the specific line:

A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.

Upon looking this up I found this stack overflow question which states that this error has something to do with geopandas. Now the full response in my command prompt was:

C:\WINDOWS\system32>pip install keplergl
Collecting keplergl
  Downloading keplergl-0.1.2.tar.gz (5.4 MB)
     |████████████████████████████████| 5.4 MB 1.6 MB/s
Collecting ipywidgets<8,>=7.0.0
  Downloading ipywidgets-7.5.1-py2.py3-none-any.whl (121 kB)
     |████████████████████████████████| 121 kB 2.2 MB/s
Collecting traittypes>=0.2.1
  Downloading traittypes-0.2.1-py2.py3-none-any.whl (8.6 kB)
Collecting geopandas>=0.5.0
  Downloading geopandas-0.7.0-py2.py3-none-any.whl (928 kB)
     |████████████████████████████████| 928 kB 3.3 MB/s
Collecting pandas>=0.23.0
  Downloading pandas-1.0.3-cp38-cp38-win32.whl (7.6 MB)
     |████████████████████████████████| 7.6 MB 78 kB/s
Collecting Shapely>=1.6.4.post2
  Downloading Shapely-1.7.0-cp38-cp38-win32.whl (895 kB)
     |████████████████████████████████| 895 kB 544 kB/s
Collecting ipykernel>=4.5.1
  Downloading ipykernel-5.2.0-py3-none-any.whl (117 kB)
     |████████████████████████████████| 117 kB 2.2 MB/s
Collecting traitlets>=4.3.1
  Downloading traitlets-4.3.3-py2.py3-none-any.whl (75 kB)
     |████████████████████████████████| 75 kB 1.2 MB/s
Collecting nbformat>=4.2.0
  Downloading nbformat-5.0.5-py3-none-any.whl (170 kB)
     |████████████████████████████████| 170 kB 3.2 MB/s
Collecting widgetsnbextension~=3.5.0
  Downloading widgetsnbextension-3.5.1-py2.py3-none-any.whl (2.2 MB)
     |████████████████████████████████| 2.2 MB 364 kB/s
Collecting ipython>=4.0.0; python_version >= "3.3"
  Downloading ipython-7.13.0-py3-none-any.whl (780 kB)
     |████████████████████████████████| 780 kB 3.3 MB/s
Collecting fiona
  Downloading Fiona-1.8.13.post1.tar.gz (1.2 MB)
     |████████████████████████████████| 1.2 MB 1.1 MB/s
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\tom\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-gksasqz1\\fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\tom\\AppData\\Local\\Temp\\pip-install-gksasqz1\\fiona\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\tom\AppData\Local\Temp\pip-install-gksasqz1\fiona\pip-egg-info'
         cwd: C:\Users\tom\AppData\Local\Temp\pip-install-gksasqz1\fiona\
    Complete output (1 lines):
    A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. 

which shows that more than one item was required including geopandas as shown here:

Collecting geopandas>=0.5.0
  Downloading geopandas-0.7.0-py2.py3-none-any.whl (928 kB)
     |████████████████████████████████| 928 kB 3.3 MB/s

If my assumption is correct then the error revolves around this area and so the stack overflow question has some importance (based on a educational guess - could be entirely wrong here 😅😅😅). From the first answer to be shown (with 7 up-votes), that has been posted by @JDOaktown, you can see that there are more than one item required for geopandas. As stated in the answer:

pip install wheels
pip install pipwin

pipwin install numpy
pipwin install pandas
pipwin install shapely
pipwin install gdal
pipwin install fiona
pipwin install pyproj
pipwin install six
pipwin install rtree
pipwin install geopandas

Source source source. If you still have problems, consider uninstalling the above (pip uninstall) and reinstalling.

You can see from here:

Collecting fiona
  Downloading Fiona-1.8.13.post1.tar.gz (1.2 MB)
     |████████████████████████████████| 1.2 MB 1.1 MB/s 

that one of the items you are told to install is relevant. Not only that - it is before installing Fiona that the error occurs for me - it may be entirely different for you. This answer however does not help much as it is for installing geopandas only and stops before installing the target keplergl. So if you keep going down you reach a post by @Josh Friedlander which has 13 up-votes. Here he states:

Geospatial Data Abstraction Library (GDAL) is a library designed for vector geospatial data formats. It's a prerequisite for installing Fiona, the Python API for OGR (which doesn't really stand for anything), which is in turn a prerequisite for Geopandas. On UNIX-like systems the gdal-config script tells Fiona stuff about your particular gdal installation.

It seems that your gdal-config is not in one of the usual places on your PATH, so Fiona was unable to find it.

If you're using Anaconda, best is to remove gdal with conda remove gdal and then do a fresh conda install geopandas.

As a general rule, if you're using Conda you should never use pip to install something inside it unless you're absolutely sure conda offers no support for it. (Many package can be found on conda by specifying the right channel - -c argument.) And specifically in the case of geopandas, the maintainers recommend using conda over pip, since pip requires you to install the dependencies correctly.

There are a few links so see HERE for them all. From here it is clear that conda is the way to go. After pip and pipwin installing all the components as instructed in the first answer I mentioned I went down to the Anaconda section (the second answer I have mention) and completed those steps. Now I have no more issues and the pip install works. If you still have issues then send me the error and I will have a look at it again. If the issues are the same then I cannot aid you any further. In the answer posted by @Pawan Upadhyay and then edited by @Bruno I found that I was getting:

Requirement already up-to-date: setuptools in c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages (46.1.3)

which means that it was not the issue for me. If it was for you then congrats on finding a shorter path than the one posted by me. Otherwise give this a try. I hope it was useful. Documentation for further reference.

like image 164
Thomas Kerby Avatar answered Nov 15 '22 08:11

Thomas Kerby