Why is pipenv failing to install dependencies in production environment but not locally? - pip

So I attempting to debug a deployment on AWS EB -> Elastic BeanStalk Django Error in Pipfile
And it seems like the issue is being caused by pipenv
error Command /bin/sh -c /usr/bin/python3.8 -m pipenv install --skip-lock
However, when I run that command locally it works fine, so I dont know what to do to fix this or investigate further on the cause of the issue.
My pipfile is:
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
appdirs = "==1.4.4"
asgiref = "==3.3.1"
"backports.entry-points-selectable" = "==1.1.0"
certifi = "==2020.11.8"
chardet = "==3.0.4"
distlib = "==0.3.1"
django-cors-headers = "==3.6.0"
djangorestframework = "==3.12.2"
filelock = "==3.0.12"
idna = "==2.10"
pipenv = "==2020.8.13"
platformdirs = "==2.2.0"
pytz = "==2020.4"
requests = "==2.25.0"
six = "==1.15.0"
sqlparse = "==0.4.1"
stripe = "==2.55.1"
urllib3 = "==1.26.2"
virtualenv = "==20.7.2"
virtualenv-clone = "==0.5.6"
Django = "==3.0.8"
Pillow = "==8.0.1"
[requires]
python_version = "3.8"
And the full error log is:
----------------------------------------
/var/log/eb-engine.log
----------------------------------------
Downloading Pillow-8.0.1-cp38-cp38-manylinux1_x86_64.whl (2.2 MB)
Collecting pipenv==2020.11.15
Downloading pipenv-2020.11.15-py2.py3-none-any.whl (3.9 MB)
Collecting pytz==2020.4
Downloading pytz-2020.4-py2.py3-none-any.whl (509 kB)
Collecting requests==2.25.0
Downloading requests-2.25.0-py2.py3-none-any.whl (61 kB)
Collecting six==1.15.0
Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting sqlparse==0.4.1
Downloading sqlparse-0.4.1-py3-none-any.whl (42 kB)
Collecting stripe==2.55.1
Downloading stripe-2.55.1-py2.py3-none-any.whl (204 kB)
Collecting urllib3==1.26.2
Downloading urllib3-1.26.2-py2.py3-none-any.whl (136 kB)
Collecting virtualenv==20.2.1
Downloading virtualenv-20.2.1-py2.py3-none-any.whl (4.9 MB)
Collecting virtualenv-clone==0.5.4
Downloading virtualenv_clone-0.5.4-py2.py3-none-any.whl (6.6 kB)
Requirement already satisfied: pip>=18.0 in /var/app/venv/staging-LQM1lest/lib/python3.8/site-packages (from pipenv==2020.11.15->-r requirements.txt (line 12)) (21.1.3)
Requirement already satisfied: setuptools>=36.2.1 in /var/app/venv/staging-LQM1lest/lib/python3.8/site-packages (from pipenv==2020.11.15->-r requirements.txt (line 12)) (57.1.0)
Installing collected packages: urllib3, sqlparse, six, pytz, idna, filelock, distlib, chardet, certifi, asgiref, appdirs, virtualenv-clone, virtualenv, requests, Django, stripe, pipenv, Pillow, djangorestframework, django-cors-headers
Successfully installed Django-3.0.8 Pillow-8.0.1 appdirs-1.4.4 asgiref-3.3.1 certifi-2020.11.8 chardet-3.0.4 distlib-0.3.1 django-cors-headers-3.6.0 djangorestframework-3.12.2 filelock-3.0.12 idna-2.10 pipenv-2020.11.15 pytz-2020.4 requests-2.25.0 six-1.15.0 sqlparse-0.4.1 stripe-2.55.1 urllib3-1.26.2 virtualenv-20.2.1 virtualenv-clone-0.5.4
2021/08/13 12:49:39.051999 [INFO] Installing dependencies with Pipfile.lock
2021/08/13 12:49:39.052013 [INFO] Running command /bin/sh -c /usr/bin/python3.8 -m pipenv install --ignore-pipfile
2021/08/13 12:49:40.248089 [INFO] Installing dependencies with Pipfile
2021/08/13 12:49:40.248118 [INFO] Running command /bin/sh -c /usr/bin/python3.8 -m pipenv install --skip-lock
2021/08/13 12:49:40.976863 [INFO] Installing dependencies from Pipfile…
2021/08/13 12:49:40.976902 [ERROR] An error occurred during execution of command [app-deploy] - [InstallDependency]. Stop running the command. Error: fail to install dependencies with Pipfile file with error Command /bin/sh -c /usr/bin/python3.8 -m pipenv install --skip-lock failed with error exit status 1. Stderr:Traceback (most recent call last):
File "/usr/lib64/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib64/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.8/site-packages/pipenv/__main__.py", line 5, in <module>
cli()
File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/pipenv/vendor/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/pipenv/cli/command.py", line 232, in install
retcode = do_install(
File "/usr/local/lib/python3.8/site-packages/pipenv/core.py", line 2052, in do_install
do_init(
File "/usr/local/lib/python3.8/site-packages/pipenv/core.py", line 1305, in do_init
do_install_dependencies(
File "/usr/local/lib/python3.8/site-packages/pipenv/core.py", line 827, in do_install_dependencies
lockfile = project.get_or_create_lockfile(from_pipfile=True)
File "/usr/local/lib/python3.8/site-packages/pipenv/project.py", line 783, in get_or_create_lockfile
lockfile_dict.update({"_meta": self.get_lockfile_meta()})
File "/usr/local/lib/python3.8/site-packages/pipenv/project.py", line 817, in get_lockfile_meta
sources = self.lockfile_content.get("_meta", {}).get("sources", [])
File "/usr/local/lib/python3.8/site-packages/pipenv/project.py", line 662, in lockfile_content
return self.load_lockfile()
File "/usr/local/lib/python3.8/site-packages/pipenv/project.py", line 1044, in load_lockfile
j = json.load(lock)
File "/usr/lib64/python3.8/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/lib64/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.8/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 4 column 1 (char 35)
2021/08/13 12:49:40.976920 [INFO] Executing cleanup logic
2021/08/13 12:49:40.977012 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed to install application dependencies. The deployment failed.","timestamp":1628858980,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1628858980,"severity":"ERROR"}]}]}
Additionally, I am operating inside a virtualenv and the command I mentioned gives me the following warning
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
I have tried to run it outside the virtualenv but can't seem to get the correct version of pipenv I have version 2021.5.29 and I need 2020.8.13 as specified by AWS in their documentation.
There is also a small difference between the python version as I use python3.8.11 and they use 3.8.5 does that make a difference?

Not a python export but the error message explicitly notes.
“Instance deployment failed to install application dependencies”
And reading the stack trace it notes.
“ json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 4 column 1 (char 35)”
Looks like you have malformed JSON in your lock file.

Related

pip install command creates syntax error : Traceback (most recent call last)

I've been trying to install bs4 and selenium from the windows powershell, and here is the error message I get :
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\cli\base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\cli\req_command.py", line 247, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\commands\install.py", line 326, in run
session = self.get_default_session(options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\cli\req_command.py", line 98, in get_default_session
self._session = self.enter_context(self._build_session(options))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\cli\req_command.py", line 125, in _build_session
session = PipSession(
^^^^^^^^^^^
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\network\session.py", line 343, in __init__
self.headers["User-Agent"] = user_agent()
^^^^^^^^^^^^
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\network\session.py", line 175, in user_agent
setuptools_dist = get_default_environment().get_distribution("setuptools")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 188, in get_distribution
return next(matches, None)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 183, in <genexpr>
matches = (
^
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\metadata\base.py", line 612, in iter_all_distributions
for dist in self._iter_distributions():
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 176, in _iter_distributions
for dist in finder.find_eggs(location):
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 146, in find_eggs
yield from self._find_eggs_in_zip(location)
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\metadata\importlib\_envs.py", line 123, in _find_eggs_in_zip
from pip._vendor.pkg_resources import find_eggs_in_zip
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3251, in <module>
#_call_aside
^^^^^^^^^^^
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3235, in _call_aside
f(*args, **kwargs)
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3277, in _initialize_master_working_set
tuple(
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3278, in <genexpr>
dist.activate(replace=False)
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2785, in activate
declare_namespace(pkg)
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2284, in declare_namespace
_handle_ns(packageName, path_item)
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2217, in _handle_ns
loader.load_module(packageName)
File "C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pygoogle\google.py", line 113
print """PyGoogle %(__version__)s
^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
I cannot install any pip package in my pc it returns that error
pip version is : pip 22.3.1
python version is : Python 3.11.1
Appreciate Your support .
I tried to install any pip package
You've installed a package PyGoogle which is very old (2006) and works only with Python 2. You need to uninstall it:
pip uninstall -y pygoogle
If that doesn't work — remove the directory C:\Users\T470\AppData\Local\Programs\Python\Python311\Lib\site-packages\pygoogle

PackageNotFoundError: Package not found: 'conda' Package 'conda' is not installed in C:\Users\user\AppData\Local\Programs\Python\Python39

my problem started when I tried to use conda create -n nam python3 and got conda.exceptions.CondaRuntimeError:
The following packages will be downloaded:
package | build
---------------------------|-----------------
vs2015_runtime-14.0.25420 | 0 2.0 MB
vc-14 | 0 703 B
python-3.6.2 | 0 31.5 MB
certifi-2016.2.28 | py36_0 214 KB
wheel-0.29.0 | py36_0 129 KB
wincertstore-0.2 | py36_0 14 KB
setuptools-36.4.0 | py36_1 534 KB
pip-9.0.1 | py36_1 1.7 MB
------------------------------------------------------------
Total: 36.0 MB
The following NEW packages will be INSTALLED:
certifi: 2016.2.28-py36_0
pip: 9.0.1-py36_1
python: 3.6.2-0
setuptools: 36.4.0-py36_1
vc: 14-0
vs2015_runtime: 14.0.25420-0
wheel: 0.29.0-py36_0
wincertstore: 0.2-py36_0
Proceed ([y]/n)?
Fetching packages ...
vs2015_runtime 100% |###############################| Time: 0:00:00 3.63 MB/s
vc-14-0.tar.bz 100% |###############################| Time: 0:00:00 140.66 kB/s
python-3.6.2-0 100% |###############################| Time: 0:00:05 5.56 MB/s
certifi-2016.2 100% |###############################| Time: 0:00:00 1.18 MB/s
wheel-0.29.0-p 100% |###############################| Time: 0:00:00 1.02 MB/s
wincertstore-0 100% |###############################| Time: 0:00:00 4.84 MB/s
setuptools-36. 100% |###############################| Time: 0:00:00 1.64 MB/s
pip-9.0.1-py36 100% |###############################| Time: 0:00:01 1.68 MB/s
Extracting packages ...
[ COMPLETE ]|##################################################| 100%
Linking packages ...
An unexpected error has occurred. | 0%
Please consider posting the following information to the
conda GitHub issue tracker at:
https://github.com/conda/conda/issues
Current conda install:
platform : win-64
conda version : 4.2.7
conda is private : False
conda-env version : 4.2.7
conda-build version : not installed
python version : 3.9.12.final.0
requests version : 2.28.1
root environment : C:\Users\user\AppData\Local\Programs\Python\Python39 (writable)
default environment : C:\Users\user\AppData\Local\Programs\Python\Python39
envs directories : C:\Users\user\AppData\Local\Programs\Python\Python39\envs
package cache : C:\Users\user\AppData\Local\Programs\Python\Python39\pkgs
channel URLs : https://repo.continuum.io/pkgs/free/win-64/
https://repo.continuum.io/pkgs/free/noarch/
https://repo.continuum.io/pkgs/pro/win-64/
https://repo.continuum.io/pkgs/pro/noarch/
https://repo.continuum.io/pkgs/msys2/win-64/
https://repo.continuum.io/pkgs/msys2/noarch/
config file : None
offline mode : False
$ C:\Users\user\miniconda3\Scripts\conda-script.py create -n nam python
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\install.py", line 201, in yield_lines
with open(path) as fh:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python39\\pkgs\\vs2015_runtime-14.0.25420-0\\info\\has_prefix'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\install.py", line 209, in yield_lines
raise StopIteration
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\cli\install.py", line 405, in install
execute_actions(actions, index, verbose=not context.quiet)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\plan.py", line 643, in execute_actions
inst.execute_instructions(plan, index, verbose)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\instructions.py", line 134, in execute_instructions
cmd(state, arg)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\instructions.py", line 78, in LINK_CMD
link(state['prefix'], dist, lt, index=state['index'])
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\install.py", line 943, in link
has_prefix_files = read_has_prefix(join(info_dir, 'has_prefix'))
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\install.py", line 248, in read_has_prefix
return {pr.filepath: (pr.placeholder, pr.filemode) for pr in parsed_lines}
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\install.py", line 248, in <dictcomp>
return {pr.filepath: (pr.placeholder, pr.filemode) for pr in parsed_lines}
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\install.py", line 247, in <genexpr>
parsed_lines = (parse_line(line) for line in yield_lines(path))
RuntimeError: generator raised StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\exceptions.py", line 472, in conda_exception_handler
return_value = func(*args, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\cli\main.py", line 144, in _main
exit_code = args.func(args, p)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\cli\main_create.py", line 68, in execute
install(args, parser, 'create')
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\conda\cli\install.py", line 420, in install
raise CondaRuntimeError('RuntimeError: %s' % e)
conda.exceptions.CondaRuntimeError: Runtime error: RuntimeError: generator raised StopIteration
my version is conda 4.2 and
I discovered that it's no longer supported, so I used conda update conda and got
PackageNotFoundError: Package not found: 'conda' Package 'conda' is not installed in C:\Users\user\AppData\Local\Programs\Python\Python39
, tried to reinstall anaconda and still got the same error.
"C:\Users\user\AppData\Local\Programs\Python\Python39"
has nothing to do with Anaconda. This the path where standard Python from python.org is installed. Why didn't you mention the 2 Python installations?
Anyhow, before you can use Anaconda you have activate it, preferably using the Anaconda prompt. Only then can you update conda.
And do yourself a favour: Either learn some conda basics from https://conda.io/projects/conda/en/latest/user-guide/getting-started.html
or remove it from your system.

Can't install gevent on termux, anyone can help me?

~ $ pip install gevent
Collecting gevent
Using cached gevent-21.12.0.tar.gz (6.2 MB)
Installing build dependencies ... done Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting zope.event
Using cached zope.event-4.5.0-py2.py3-none-any.whl (6.8 kB)
Requirement already satisfied: setuptools in /data/data/com.termux/files/usr/lib/python3.10/site-packages (from gevent) (58.1.0)
Collecting zope.interface
Using cached zope.interface-5.4.0-cp310-cp310-linux_aarch64.whl
Requirement already satisfied: greenlet<2.0,>=1.1.0 in /data/data/com.termux/files/usr/lib/python3.10/site-packages (from gevent) (1.1.2)
Building wheels for collected packages: gevent
Building wheel for gevent (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for gevent (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [63 lines of output]
running bdist_wheel
running build
running build_py
running build_ext
generating cffi module 'build/temp.linux-aarch64-3.10/gevent.libuv._corecffi.c'
Running '(cd
"/data/data/com.termux/files/usr/tmp/pip-install-55j041qz/gevent_018671f4e2174ad19170736008c5782a/deps/libev" && sh ./configure -C
configure-output.txt )' in /data/data/com.termux/files/usr/tmp/pip-install-55j041qz/gevent_018671f4e2174ad19170736008c5782a
configure: error: no acceptable ld found in $PATH
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in
main()
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 230, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
self.run_setup()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 267, in run_setup
super(_BuildMetaLegacyBackend,
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 481, in <module>
run_setup(EXT_MODULES)
File "setup.py", line 348, in run_setup
setup(
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 155, in setup
return distutils.core.setup(**attrs)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 148, in setup
return run_commands(dist)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
dist.run_commands()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
self.run_command(cmd)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/cffi/setuptools_ext.py", line 143, in run
ext.sources[0] = make_mod(self.build_temp, pre_run)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-l1wl_veu/overlay/lib/python3.10/site-packages/cffi/setuptools_ext.py", line 128, in make_mod
pre_run(ext, ffi)
File "/data/data/com.termux/files/usr/tmp/pip-install-55j041qz/gevent_018671f4e2174ad19170736008c5782a/_setuputils.py", line 364, in pre_run
action()
File "/data/data/com.termux/files/usr/tmp/pip-install-55j041qz/gevent_018671f4e2174ad19170736008c5782a/_setuplibev.py", line 55, in configure_libev
system(libev_configure_command)
File "/data/data/com.termux/files/usr/tmp/pip-install-55j041qz/gevent_018671f4e2174ad19170736008c5782a/_setuputils.py", line 195, in system
if _system(cmd, cwd=cwd, env=env, **kwargs):
File "/data/data/com.termux/files/usr/tmp/pip-install-55j041qz/gevent_018671f4e2174ad19170736008c5782a/_setuputils.py", line 191, in _system
return check_call(cmd, cwd=cwd, env=env, **kwargs)
File "/data/data/com.termux/files/usr/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '(cd "/data/data/com.termux/files/usr/tmp/pip-install-55j041qz/gevent_018671f4e2174ad19170736008c5782a/deps/libev" && sh ./configure -C > configure-output.txt )' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for gevent
Failed to build gevent
ERROR: Could not build wheels for gevent, which is required to install pyproject.toml-based projects
~ $
try lower versions
https://pypi.org/project/gevent/#history
I have tried all the versions I see 20.4.0 Is the best
Try:
pkg install binutils
This worked for me.

Running CI tests with PyQT

I am setting up a CI Bitbucket pipeline for my team. We are using pytest and pytest-qt to test our software. The tests run locally without any issue, but the build fails using pipeline. Here is the pipeline yml:
image: python:3.9
pipelines:
default:
- parallel:
- step:
name: Test
caches:
- pip
script:
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- pip install pytest
- pip install pytest-qt
- pytest -v tools/IntegrationTests.py --junitxml=test-reports/report.xml
The file requirements.txt contains several modules including:
PyQt5==5.15.4
PyQt5-Qt5==5.15.2
And here is the output when trying to build:
+ pytest -v tools/IntegrationTests.py --junitxml=test-reports/report.xml
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/main.py", line 265, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 982, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/hooks.py", line 308, in call_historic
INTERNALERROR> res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pytestqt/plugin.py", line 203, in pytest_configure
INTERNALERROR> qt_api.set_qt_api(config.getini("qt_api"))
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pytestqt/qt_compat.py", line 104, in set_qt_api
INTERNALERROR> self.QtGui = _import_module("QtGui")
INTERNALERROR> File "/usr/local/lib/python3.9/site-packages/pytestqt/qt_compat.py", line 100, in _import_module
INTERNALERROR> m = __import__(_root_module, globals(), locals(), [module_name], 0)
INTERNALERROR> ImportError: libGL.so.1: cannot open shared object file: No such file or directory
What I get from that is that Qt is not properly installed remotely, thus the tests cannot run.
My question is: can GUI be tested in CI, and if yes, how?
EDIT:
I have broke down to test only the import of PyQt and it boiled down to this test suite:
def test_import_widgets():
from PyQt5 import QtWidgets
def test_import_core():
from PyQt5 import QtCore
def test_import_gui():
from PyQt5 import QtGui
def test_import_qt():
from PyQt5.QtCore import Qt
Which have resulted in the following results:
2 / 4 tests failed
BasicsTests.test_import_guitools
<1s
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
def test_import_gui():
> from PyQt5 import QtGui
E ImportError: libGL.so.1: cannot open shared object file: No such file or directory
tools/BasicsTests.py:50: ImportError
BasicsTests.test_import_widgetstools
<1s
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
def test_import_widgets():
> from PyQt5 import QtWidgets
E ImportError: libGL.so.1: cannot open shared object file: No such file or directory
tools/BasicsTests.py:42: ImportError
You have to install the Qt dependencies:
image: python:3.9
pipelines:
default:
- parallel:
- step:
name: Test
caches:
- pip
script:
- apt-get update && apt-get autoclean
- apt-get install -y '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- pip install pytest
- pip install pytest-qt
- pytest -v tools/IntegrationTests.py --junitxml=test-reports/report.xml

Cloud Init Fails to Install Packages on CentOS 7 in EC2

I have a cloud config file defined on my EC2 instance in the user data. Many of the parts/actions are run by the server properly, but package installation seems to fail invariably:
#cloud-config
package-update: true
package-upgrade: true
# ...
packages:
- puppet3
- lvm2
- btrfs-progs
# ...
I see the following in the logs:
May 20 20:23:39 cloud-init[1252]: util.py[DEBUG]: Package update failed
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 74, in handle
cloud.distro.update_package_sources()
File "/usr/lib/python2.6/site-packages/cloudinit/distros/rhel.py", line 278, in update_package_sources
["makecache"], freq=PER_INSTANCE)
File "/usr/lib/python2.6/site-packages/cloudinit/helpers.py", line 197, in run
results = functor(*args)
File "/usr/lib/python2.6/site-packages/cloudinit/distros/rhel.py", line 274, in package_command
util.subp(cmd, capture=False, pipe_cat=True, close_stdin=True)
File "/usr/lib/python2.6/site-packages/cloudinit/util.py", line 1529, in subp
cmd=args)
ProcessExecutionError: Unexpected error while running command.
Command: ['yum', '-t', '-y', 'makecache']
Exit code: 1
Reason: -
Stdout: ''
Stderr: ''
May 20 20:23:39 cloud-init[1252]: amazon.py[DEBUG]: Upgrade level: security
May 20 20:23:39 cloud-init[1252]: util.py[DEBUG]: Running command ['yum', '-t', '-y', '--exclude=kernel', '--exclude=nvidia*', '--exclude=cudatoolkit', '--security', '--sec-severity=critical', '--sec-severity=important', 'upgrade'] with allowed return codes [0] (shell=False, capture=False)
May 20 20:23:52 cloud-init[1252]: util.py[WARNING]: Package upgrade failed
May 20 20:23:52 cloud-init[1252]: util.py[DEBUG]: Package upgrade failed
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 81, in handle
cloud.distro.upgrade_packages(upgrade_level, upgrade_exclude)
File "/usr/lib/python2.6/site-packages/cloudinit/distros/amazon.py", line 50, in upgrade_packages
return self.package_command('upgrade', args=args)
File "/usr/lib/python2.6/site-packages/cloudinit/distros/rhel.py", line 274, in package_command
util.subp(cmd, capture=False, pipe_cat=True, close_stdin=True)
File "/usr/lib/python2.6/site-packages/cloudinit/util.py", line 1529, in subp
cmd=args)
ProcessExecutionError: Unexpected error while running command.
Command: ['yum', '-t', '-y', '--exclude=kernel', '--exclude=nvidia*', '--exclude=cudatoolkit', '--security', '--sec-severity=critical', '--sec-severity=important', 'upgrade']
Exit code: 1
Reason: -
Stdout: ''
Stderr: ''
May 20 20:23:52 cloud-init[1252]: util.py[DEBUG]: Running command ['yum', '-t', '-y', 'install', 'puppet3', 'lvm2', 'btrfs-progs'] with allowed return codes [0] (shell=False, capture=False)
May 20 20:24:03 cloud-init[1252]: util.py[WARNING]: Failed to install packages: ['puppet3', 'lvm2', 'btrfs-progs']
May 20 20:24:03 cloud-init[1252]: util.py[DEBUG]: Failed to install packages: ['puppet3', 'lvm2', 'btrfs-progs']
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 88, in handle
cloud.distro.install_packages(pkglist)
File "/usr/lib/python2.6/site-packages/cloudinit/distros/rhel.py", line 70, in install_packages
self.package_command('install', pkgs=pkglist)
File "/usr/lib/python2.6/site-packages/cloudinit/distros/rhel.py", line 274, in package_command
util.subp(cmd, capture=False, pipe_cat=True, close_stdin=True)
File "/usr/lib/python2.6/site-packages/cloudinit/util.py", line 1529, in subp
cmd=args)
ProcessExecutionError: Unexpected error while running command.
Command: ['yum', '-t', '-y', 'install', 'puppet3', 'lvm2', 'btrfs-progs']
Exit code: 1
Reason: -
Stdout: ''
Stderr: ''
May 20 20:24:03 cloud-init[1252]: cc_package_update_upgrade_install.py[WARNING]: 3 failed with exceptions, re-raising the last one
May 20 20:24:03 cloud-init[1252]: util.py[WARNING]: Running package-update-upgrade-install (<module 'cloudinit.config.cc_package_update_upgrade_install' from '/usr/lib/python2.6/site-packages/cloudinit/config/cc_package_update_upgrade_install.pyc'>) failed
May 20 20:24:03 cloud-init[1252]: util.py[DEBUG]: Running package-update-upgrade-install (<module 'cloudinit.config.cc_package_update_upgrade_install' from '/usr/lib/python2.6/site-packages/cloudinit/config/cc_package_update_upgrade_install.pyc'>) failed
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cloudinit/stages.py", line 553, in _run_modules
cc.run(run_name, mod.handle, func_args, freq=freq)
File "/usr/lib/python2.6/site-packages/cloudinit/cloud.py", line 63, in run
return self._runners.run(name, functor, args, freq, clear_on_fail)
File "/usr/lib/python2.6/site-packages/cloudinit/helpers.py", line 197, in run
results = functor(*args)
File "/usr/lib/python2.6/site-packages/cloudinit/config/cc_package_update_upgrade_install.py", line 111, in handle
raise errors[-1]
ProcessExecutionError: Unexpected error while running command.
Command: ['yum', '-t', '-y', 'install', 'puppet3', 'lvm2', 'btrfs-progs']
Exit code: 1
Reason: -
Stdout: ''
Stderr: ''
When I actually run the command yum -t -y install puppet3 lvm2 btrfs-progs as root, it just runs fine, but Cloud Init is failing to run it on its own.
Is there something I'm doing wrong here?
Evidently there was a bug fixed with later versions of the image. If this is happening to you, it may be a legitimate bug in Cloud-Init or your servers implementation of it. A package upgrade may fix the problem, also an update to the image will fix it globally.

Resources