error in ibm_db setup command: use_2to3 is invalid [duplicate] - python

This question already has answers here:
Error while downloading the requirements using pip install (setup command: use_2to3 is invalid.)
(6 answers)
Closed 1 year ago.
I am trying to install ibm_db_sa in my miniconda virtual environment (python 3.6). I am seeing this error and it could be because I am a separate user on my laptop and not the admin. Is there any solution/workaround this?
sudo pip install ibm_db_sa
Password:
WARNING: The directory '/Users/myname/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting ibm_db_sa
Downloading ibm_db_sa-0.3.7.tar.gz (30 kB)
Requirement already satisfied: sqlalchemy>=0.7.3 in /usr/local/Caskroom/miniconda/base/envs/finalenv/lib/python3.6/site-packages (from ibm_db_sa) (1.4.25)
Collecting ibm_db>=2.0.0
Downloading ibm_db-3.0.4.tar.gz (796 kB)
|████████████████████████████████| 796 kB 1.1 MB/s
ERROR: Command errored out with exit status 1:
command: /usr/local/Caskroom/miniconda/base/envs/finalenv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-2fdrlxey/ibm-db_375dbdf21455451c871e608261014786/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-2fdrlxey/ibm-db_375dbdf21455451c871e608261014786/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 /private/tmp/pip-pip-egg-info-jzevidp0
cwd: /private/tmp/pip-install-2fdrlxey/ibm-db_375dbdf21455451c871e608261014786/
Complete output (3 lines):
Detected 64-bit Python
Downloading https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/macos64_odbc_cli.tar.gz
error in ibm_db setup command: use_2to3 is invalid.
WARNING: Discarding https://files.pythonhosted.org/packages/b6/0c/a8d57078772abcc876f6a2be2252f12284aa6f71f41d3c2910f23369d7d2/ibm_db-2.0.6.1.tar.gz#sha256=bdc6543702e19d8ff7a0ddef715a9ee32a7753686cbcfe99095c2e357efe4135 (from https://pypi.org/simple/ibm-db/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Downloading ibm_db-2.0.5.1.tar.gz (460 kB)
|████████████████████████████████| 460 kB 1.1 MB/s
ERROR: No .egg-info directory found in /private/tmp/pip-pip-egg-info-y8tp952r

The issue you ran into seems related to a problem with setuptools. See this issue in the GitHub repository for the ibm_db driver.

Related

Installing win32com for python 3.8.8 [duplicate]

This question already has an answer here:
Installing the pypiwin32 module
(1 answer)
Closed 10 months ago.
I have tried installing win32com on python version 3.8.8 using several methods finally settling on
!python -m pip install pypiwin32
However I am getting this error.
Collecting pypiwin32
Downloading pypiwin32-223-py3-none-any.whl (1.7 kB)
Downloading pypiwin32-219.zip (4.8 MB)
|████████████████████████████████| 4.8 MB 3.2 MB/s eta 0:00:01
ERROR: Command errored out with exit status 1:
command: /opt/conda/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rxlumrt5/pypiwin32_d674fe4e172b4a5ab12b6b8f2aeb2d90/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rxlumrt5/pypiwin32_d674fe4e172b4a5ab12b6b8f2aeb2d90/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 /tmp/pip-pip-egg-info-eb1keprl
cwd: /tmp/pip-install-rxlumrt5/pypiwin32_d674fe4e172b4a5ab12b6b8f2aeb2d90/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-rxlumrt5/pypiwin32_d674fe4e172b4a5ab12b6b8f2aeb2d90/setup.py", line 121
print "Building pywin32", pywin32_version
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Building pywin32", pywin32_version)?
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/2b/ca/5c086c18de8f70222787b3e824e755b68d99272531522e77bb381d4f60c8/pypiwin32-219.zip#sha256=06d478295c89dbdd4187e1ac099bb8eab93c29e298bded4e2fbc77009287fa44 (from https://pypi.org/simple/pypiwin32/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pywin32>=223 (from pypiwin32)
ERROR: No matching distribution found for pywin32>=223
Requesting assistance.
Thanks and Regards,
Yadhunandan
Last time I used win32com I installed the package pywin32, not pypiwin32. I am not sure how well pypiwin32 is maintained, as there is no project description on pypi and it only has 3 Releases, the last being in 2018 (https://pypi.org/project/pypiwin32/).
So maybe try this one:
https://pypi.org/project/pywin32/

Failed to build pypiwin32

Alright so what I've been trying to do the past hour is install the pywintypes lib and searched up that it was pypiwin32 instead but it doesn't work it fails to build additionally tried installing it manually by downloading the source and running setup.py but got same err: I get this error and I have python 3.10
Collecting pypiwin32
Using cached pypiwin32-223-py3-none-any.whl (1.7 kB)
Using cached pypiwin32-219.zip (4.8 MB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Rasmus\AppData\Local\Programs\Python\Python310\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Rasmus\\AppData\\Local\\Temp\\pip-install-3z4zmi2y\\pypiwin32_ec886c51d7334f269d55dee9cd57e04b\\setup.py'"'"'; __file__='"'"'C:\\Users\\Rasmus\\AppData\\Local\\Temp\\pip-install-3z4zmi2y\\pypiwin32_ec886c51d7334f269d55dee9cd57e04b\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Rasmus\AppData\Local\Temp\pip-pip-egg-info-6dg0frr7'
cwd: C:\Users\Rasmus\AppData\Local\Temp\pip-install-3z4zmi2y\pypiwin32_ec886c51d7334f269d55dee9cd57e04b\
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Rasmus\AppData\Local\Temp\pip-install-3z4zmi2y\pypiwin32_ec886c51d7334f269d55dee9cd57e04b\setup.py", line 121
print "Building pywin32", pywin32_version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/2b/ca/5c086c18de8f70222787b3e824e755b68d99272531522e77bb381d4f60c8/pypiwin32-219.zip#sha256=06d478295c89dbdd4187e1ac099bb8eab93c29e298bded4e2fbc77009287fa44 (from https://pypi.org/simple/pypiwin32/). Command errored out with exit status 1:
python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pywin32>=223 (from pypiwin32) (from versions: none)
ERROR: No matching distribution found for pywin32>=223
the only solution I can see is to downgrade from python 3.10 down to 3.9
pywin32 version 302 (NOT pypiwin32, which looks like a mistake from 2018) was uploaded to PyPi on October 10, 2021, and states in the change log:
Support for Python 10, dropped support for Python 3.5 (3.5 security support
ended 13 Sep 2020)
Demo (using PyLauncher to update my 3.10 install):
C:\>py -3.10 -m pip install pywin32
Collecting pywin32
Downloading pywin32-302-cp310-cp310-win_amd64.whl (9.2 MB)
|████████████████████████████████| 9.2 MB 6.8 MB/s
Installing collected packages: pywin32
Successfully installed pywin32-302
Make sure to run the Scripts\pywin32_postinstall.py from an administrator command prompt as well to register it properly. Make sure it runs in the context of the 3.10 installation as well (again using PyLauncher):
C:\Python310\Scripts>py -3.10 pywin32_postinstall.py -install
Parsed arguments are: Namespace(install=True, remove=False, wait=None, silent=False, quiet=False, destination='C:\\Python310\\Lib\\site-packages')
Copied pythoncom310.dll to C:\windows\system32\pythoncom310.dll
Copied pywintypes310.dll to C:\windows\system32\pywintypes310.dll
Registered: Python.Interpreter
Registered: Python.Dictionary
Registered: Python
-> Software\Python\PythonCore\3.10\Help[None]=None
-> Software\Python\PythonCore\3.10\Help\Pythonwin Reference[None]='C:\\Python310\\Lib\\site-packages\\PyWin32.chm'
Registered help file
Pythonwin has been registered in context menu
Shortcut for Pythonwin created
Shortcut to documentation created
The pywin32 extensions were successfully installed.

Geopandas error message during installation

I am trying install geopandas. I have using codes I can't find but i keep getting error messages. I have geopy already installed but can't install geopandas.
Result i had when running installation with anaconda prompt:
I had also tried installation using %pip install geopandas --user
Collecting geopandas
Using cached geopandas-0.8.1-py2.py3-none-any.whl (962 kB)
Collecting pyproj>=2.2.0
Using cached pyproj-2.6.1.post1-cp38-cp38-win32.whl (15.7 MB)
Collecting shapely
Using cached Shapely-1.7.1-cp38-cp38-win32.whl (894 kB)
Requirement already satisfied: pandas>=0.23.0 in c:\users\fejiro\anaconda3\lib\site-packages (from geopandas) (1.0.5)
Collecting fiona
Using cached Fiona-1.8.17.tar.gz (1.3 MB)
Note: you may need to restart the kernel to use updated packages.
ERROR: Command errored out with exit status 1:
command: 'C:\Users\fejiro\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\fejiro\\AppData\\Local\\Temp\\pip-install-q86d5ghj\\fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\fejiro\\AppData\\Local\\Temp\\pip-install-q86d5ghj\\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\fejiro\AppData\Local\Temp\pip-pip-egg-info-64u_nnsk'
cwd: C:\Users\fejiro\AppData\Local\Temp\pip-install-q86d5ghj\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.
Can someone tell what to do?
It s better to use Anaconda distribution for more complex packages. Use install anaconda and then create an environment for the project. After that, you could use conda-forge to take care of all the compatibility problems

Error installing geopandas:“ A GDAL API version must be specified ” in Visual Studio Code

This error raised while installing geopandas in vs code. I've looking for its solution on the web, but none of them really explain what happened and how to solve it..
Collecting geopandas
Downloading geopandas-0.7.0-py2.py3-none-any.whl (928 kB)
|████████████████████████████████| 928 kB 726 kB/s
Collecting shapely
Downloading Shapely-1.7.0-cp38-cp38-win32.whl (895 kB)
|████████████████████████████████| 895 kB 437 kB/s
Requirement already satisfied: pandas>=0.23.0 in c:\users\mayank\appdata\local\programs\python\python38-32\lib\site-packages (from geopandas) (1.0.3)
Collecting fiona
Downloading Fiona-1.8.13.post1.tar.gz (1.2 MB)
|████████████████████████████████| 1.2 MB 506 kB/s
ERROR: Command errored out with exit status 1:
command: 'C:\Users\mayank\AppData\Local\Programs\Python\Python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-1le2w4at\\fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\mayank\\AppData\\Local\\Temp\\pip-install-1le2w4at\\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\mayank\AppData\Local\Temp\pip-pip-egg-info-e_ca92eu'
cwd: C:\Users\mayank\AppData\Local\Temp\pip-install-1le2w4at\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.
First you need to do is to install gdal package. I install it by pip with:
pip install https://download.lfd.uci.edu/pythonlibs/w4tscw6k/GDAL-3.2.2-cp39-cp39-win_amd64.whl
Tips: Do not install it directly through the normal pip usage: pip install gdal . You can find a compatible version of gdal for your python3.x Here.
After you have installed gdal, you can do that for fiano, Eg:
pip install https://download.lfd.uci.edu/pythonlibs/w4tscw6k/Fiona-1.8.18-cp39-cp39-win_amd64.whl
Finally, all of them can be installed successfully...
Fiona which is a dependency of geopandas requires a GDAL instance. When installing it needs looks to the PATH environment variable to find the GDAL location. If the PATH doesn't have a reference it fails to install. I found a work around is to grab the GDAL and fiona whl files and install from a local copy.

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 : )
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.
it means your tools are not up to date
Can you try this in command prompt?
pip install --upgrade setuptools

Categories

Resources