Getting "ERROR: Double requirement given: setuptools" error in zappa - python

I tried to deploy my Flask app with zappa==0.52.0, but I get an error as below;
ERROR: Double requirement given: setuptools (already in setuptools==52.0.0.post20210125, name='setuptools')
WARNING: You are using pip version 20.2.3; however, version 21.1.3 is available.
You should consider upgrading via the '/Users/yoonshinkwark/Documents/JBR_reco_local_2/JBR_reco_API_2/dola-aldagram/aws-flask38/bin/python3.8 -m pip install --upgrade pip' command.
Oh no! An error occurred! :(
Traceback (most recent call last):
File "/Users/yoonshinkwark/opt/anaconda3/lib/python3.8/site-packages/zappa/cli.py", line 3422, in handle
sys.exit(cli.handle())
File "/Users/yoonshinkwark/opt/anaconda3/lib/python3.8/site-packages/zappa/cli.py", line 588, in handle
self.dispatch_command(self.command, stage)
File "/Users/yoonshinkwark/opt/anaconda3/lib/python3.8/site-packages/zappa/cli.py", line 630, in dispatch_command
self.deploy(self.vargs["zip"], self.vargs["docker_image_uri"])
File "/Users/yoonshinkwark/opt/anaconda3/lib/python3.8/site-packages/zappa/cli.py", line 852, in deploy
self.create_package()
File "/Users/yoonshinkwark/opt/anaconda3/lib/python3.8/site-packages/zappa/cli.py", line 2760, in create_package
venv=self.zappa.create_handler_venv(),
File "/Users/yoonshinkwark/opt/anaconda3/lib/python3.8/site-packages/zappa/core.py", line 513, in create_handler_venv
raise EnvironmentError("Pypi lookup failed")
OSError: Pypi lookup failed
The version of Python is 3.8.8.

There is already an issue in the zappa github:
https://github.com/zappa/Zappa/issues/995
The problem is that zappa adds setup-tools to its dependencies but the latest release of pip-tools (6.2.0) does the same now.
As a quick fix, you can pin pip-tools to version 6.1.0 in your requirements.txt

Related

pip uninstall GDAL gives AttributeError: 'PathMetadata' object has no attribute 'isdir'

I'm trying to pip install geopandas as a fresh installation, so I want to remove existing packages like GDAL and fiona. I've already managed to pip uninstall fiona, but when I try to uninstall or reinstall GDAL it gives the following error message:
(base) C:\usr>pip install C:/usr/Anaconda3/Lib/site-packages/GDAL-3.4.1-cp38-cp38-win_amd64.whl
Processing c:\usr\anaconda3\lib\site-packages\gdal-3.4.1-cp38-cp38-win_amd64.whl
Installing collected packages: GDAL
Attempting uninstall: GDAL
Found existing installation: GDAL 3.0.2
ERROR: Exception:
Traceback (most recent call last):
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\cli\base_command.py", line 167, in exc_logging_wrapper
status = run_func(*args)
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
return func(self, options, args)
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\commands\install.py", line 405, in run
installed = install_given_reqs(
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\req\__init__.py", line 68, in install_given_reqs
uninstalled_pathset = requirement.uninstall(auto_confirm=True)
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\req\req_install.py", line 637, in uninstall
uninstalled_pathset = UninstallPathSet.from_dist(dist)
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 554, in from_dist
for script in dist.iterdir("scripts"):
File "C:\usr\Anaconda3\lib\site-packages\pip\_internal\metadata\pkg_resources.py", line 156, in iterdir
if not self._dist.isdir(name):
File "C:\usr\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2816, in __getattr__
return getattr(self._provider, attr)
AttributeError: 'PathMetadata' object has no attribute 'isdir'
Does anyone know why GDAL cannot be uninstalled?
I just came across this question after getting the same error. Coincidentally I had just upgraded pip (I was getting tired of the yellow warnings).
All I had was to down grade my pip
pip install pip==21.3.1 --user
I was seeing the same AttributeError as you when trying to install google-cloud-firestore. My solution was to upgrade my version of pip. In my case, I upgraded to pip from 22.0.2 to 22.3.1
pip install --upgrade pip

Errors installing pygit2 on CentOs

I am trying to install pygit2 on Centos and am getting the following error
I would be grateful if anyone could suggest what may be wrong
thanks
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pygit2
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Using cached pygit2-0.25.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-uSxy32/pygit2/setup.py", line 60, in <module>
from _run import ffi, preamble, C_KEYWORDS
File "pygit2/_run.py", line 72, in <module>
ffi.cdef(C_HEADER_SRC)
File "/usr/lib64/python2.6/site-packages/cffi/api.py", line 97, in cdef
self._parser.parse(csource, override=override)
File "/usr/lib64/python2.6/site-packages/cffi/cparser.py", line 154, in parse
self._internal_parse(csource)
File "/usr/lib64/python2.6/site-packages/cffi/cparser.py", line 159, in _internal_parse
ast, macros = self._parse(csource)
File "/usr/lib64/python2.6/site-packages/cffi/cparser.py", line 126, in _parse
self.convert_pycparser_error(e, csource)
File "/usr/lib64/python2.6/site-packages/cffi/cparser.py", line 148, in convert_pycparser_error
raise api.CDefError(msg)
cffi.api.CDefError: cannot parse "typedef int64_t git_time_t;"
:640: Multiple type specifiers with a type tag
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-uSxy32/pygit2
Looking at https://github.com/libgit2/pygit2/issues/470 it looks like you need to first run:
pip install --upgrade pip
pip upgrade pycparser

Error in installing scikit-learn in ubuntu

When is try to install scikit learn, im getting this error,
I used "pip install -U scikit-learn[alldeps]"
"""Collecting scikit-learn[alldeps]
Using cached scikit_learn-0.18.1-cp27-cp27mu-manylinux1_x86_64.whl
Requirement already up-to-date: numpy>=1.6.1; extra == "alldeps" in /usr/local/lib/python2.7/dist-packages (from scikit-learn[alldeps])
Collecting scipy>=0.9; extra == "alldeps" (from scikit-learn[alldeps])
Using cached scipy-0.19.0-cp27-cp27mu-manylinux1_x86_64.whl
Installing collected packages: scipy, scikit-learn
Found existing installation: scipy 0.17.0
DEPRECATION: Uninstalling a distutils installed project (scipy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling scipy-0.17.0:
Exception:
Traceback (most recent call last):
File "/home/suba/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/suba/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/home/suba/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/home/suba/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/home/suba/.local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/home/suba/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/usr/lib/python2.7/shutil.py", line 303, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/dist-packages/scipy-0.17.0.egg-info' """
How can i fix this error?
Permission error.
sudo pip install -U scikit-learn[alldeps] could help.
There's a permission error. Are you using root permissions to install? If not, please use same command prefixed with 'sudo' and provide password when asked.

Python 3.5.1 Cannot download Robot Framework library

I'm new to Python and I'm trying to automate a test with Robot Framework. When I tried downloading the library via pip I ran into some issues.
I'm using Python 3.5.1, Robot Framework 3.0, PyCharm 2016.1(64),
Output for command pip install robotframework-selenium2library:
Collecting robotframework-selenium2library
Using cached robotframework-selenium2library-1.7.4.tar.gz
Complete output from command python setup.py egg_info:
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.14.tar.gz
Extracting in C:\Users\Radek\AppData\Local\Temp\tmpooendh2g
Traceback (most recent call last):
File "c:\users\radek\appdata\local\programs\python\python35\lib\site-packages\ez_setup.py", line 143, in use_setuptools
raise ImportError
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Radek\AppData\Local\Temp\pip-build-gh4jw21a\robotframework-selenium2library\setup.py", line 8, in <module>
use_setuptools()
File "c:\users\radek\appdata\local\programs\python\python35\lib\site-packages\ez_setup.py", line 145, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "c:\users\radek\appdata\local\programs\python\python35\lib\site-packages\ez_setup.py", line 125, in _do_download
_build_egg(egg, tarball, to_dir)
File "c:\users\radek\appdata\local\programs\python\python35\lib\site-packages\ez_setup.py", line 99, in _build_egg
_extractall(tar)
File "c:\users\radek\appdata\local\programs\python\python35\lib\site-packages\ez_setup.py", line 467, in _extractall
self.chown(tarinfo, dirpath)
TypeError: chown() missing 1 required positional argument: 'numeric_owner'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Radek\AppData\Local\Temp\pip-build-gh4jw21a\robotframework-selenium2library\
Setuptools are up-to-date, so is ez_setup
C:\Users\Radek>pip install --upgrade setuptools
Requirement already up-to-date: setuptools in c:\users\radek\appdata\local\programs\python\python35\lib\site-packages
C:\Users\Radek>pip install ez_setup
Requirement already satisfied (use --upgrade to upgrade): ez-setup in c:\users\radek\appdata\local\programs\python\python35\lib\site-packages
Selenium2Library is not (yet) compatible with Python 3.x.
We have a Pull Request (github.com/robotframework/Selenium2Library/pull/564) to have Selenium2Library compatible with all Python versions, but it is not in the official Release, and it was tested with Python 2.6, 2.7 and 3.4.
I you want to install you could try github.com/HelioGuilherme66/robotframework-selenium2library/releases/tag/v1.8.0b1
For example with:
pip install -U --pre https://github.com/HelioGuilherme66/robotframework-selenium2library/archive/v1.8.0b1.zip

Installing praw on a mac

I have already installed homebrew and pip. When I run $pip install praw the following comes up:
dhcp-215-185:~ my_name$ pip install praw
Downloading/unpacking praw
Downloading praw-2.1.16-py2.py3-none-any.whl (70kB): 70kB downloaded
Downloading/unpacking update-checker>=0.10 (from praw)
Downloading update_checker-0.10-py2.py3-none-any.whl
Downloading/unpacking requests>=1.2.0 (from praw)
Downloading requests-2.2.1-py2.py3-none-any.whl (625kB): 625kB downloaded
Downloading/unpacking six>=1.4 (from praw)
Downloading six-1.6.1-py2.py3-none-any.whl
Installing collected packages: praw, update-checker, requests, six
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.5-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.5-py2.7.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.7/site-packages/pip-1.5.5-py2.7.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Library/Python/2.7/site-packages/pip-1.5.5-py2.7.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-1.5.5-py2.7.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/Library/Python/2.7/site-packages/pip-1.5.5-py2.7.egg/pip/wheel.py", line 215, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-1.5.5-py2.7.egg/pip/wheel.py", line 205, in clobber
os.makedirs(destdir)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/praw'
Storing debug log for failure in /Users/my_name/Library/Logs/pip.log
dhcp-215-185:~ my_name$
Does anyone have a fix? Installing this has been a real headache. Thanks a lot!
A quick workaround would be to use the sudo pip install praw command to intall praw as a super-user. However, this is not recommended, as it can cause problems later on with things such as updates and scaling your application upwards. One would instead suggest that you create a virtual environment, and pip install praw inside it.
If you are confident that the application you are building will not grow too large, it is probably ok to install praw using sudo.
I was getting the same error as you and I found an answer in the reddit documentation for PRAW. I used HomeBrew to install pip and I'm using Python 3.x instead of the 2.7x that's shipped with OSX, which means I needed to use pip3 instead of pip. It worked right away.
I hope this helps!

Categories

Resources