How to fix locking failed in pipenv? - python

I'm using pipenv inside a docker container. I tried installing a package and found that the installation succeeds (gets added to the Pipfile), but the locking keeps failing. Everything was fine until yesterday. Here's the error:
(app) root#7284b7892266:/usr/src/app# pipenv install scrapy-djangoitem
Installing scrapy-djangoitem…
Adding scrapy-djangoitem to Pipfile's [packages]…
✔ Installation Succeeded
Pipfile.lock (6d808e) out of date, updating to (27ac89)…
Locking [dev-packages] dependencies…
Building requirements...
Resolving dependencies...
✘ Locking Failed!
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pipenv/resolver.py", line 807, in <module>
main()
File "/usr/local/lib/python3.7/site-packages/pipenv/resolver.py", line 803, in main
parsed.requirements_dir, parsed.packages, parse_only=parsed.parse_only)
File "/usr/local/lib/python3.7/site-packages/pipenv/resolver.py", line 785, in _main
resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages)
File "/usr/local/lib/python3.7/site-packages/pipenv/resolver.py", line 758, in resolve_packages
results = clean_results(results, resolver, project)
File "/usr/local/lib/python3.7/site-packages/pipenv/resolver.py", line 634, in clean_results
reverse_deps = project.environment.reverse_dependencies()
File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 376, in environment
self._environment = self.get_environment(allow_global=allow_global)
File "/usr/local/lib/python3.7/site-packages/pipenv/project.py", line 366, in get_environment
environment.extend_dists(pipenv_dist)
File "/usr/local/lib/python3.7/site-packages/pipenv/environment.py", line 127, in extend_dists
extras = self.resolve_dist(dist, self.base_working_set)
File "/usr/local/lib/python3.7/site-packages/pipenv/environment.py", line 122, in resolve_dist
deps |= cls.resolve_dist(dist, working_set)
File "/usr/local/lib/python3.7/site-packages/pipenv/environment.py", line 121, in resolve_dist
dist = working_set.find(req)
File "/root/.local/share/virtualenvs/app-lp47FrbD/lib/python3.7/site-packages/pkg_resources/__init__.py", line 642, in find
raise VersionConflict(dist, req)
pkg_resources.VersionConflict: (importlib-metadata 2.0.0 (/root/.local/share/virtualenvs/app-lp47FrbD/lib/python3.7/site-packages), Requirement.parse('importlib-metadata<2,>=0.12; python_version < "3.8"'))
(app) root#7284b7892266:/usr/src/app#
What could be wrong?
EDIT
After removing Pipfile.lock and trying to install a package, I got:
(app) root#ef80787b5c42:/usr/src/app# pipenv install httpx
Installing httpx…
Adding httpx to Pipfile's [packages]…
✔ Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Building requirements...
Resolving dependencies...
✔ Success!
Locking [packages] dependencies…
Building requirements...
⠏ Locking...Resolving dependencies...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/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.7/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pipenv/cli/command.py", line 252, in install
site_packages=state.site_packages
File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 2202, in do_install
skip_lock=skip_lock,
File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 1303, in do_init
pypi_mirror=pypi_mirror,
File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 1113, in do_lock
keep_outdated=keep_outdated
File "/usr/local/lib/python3.7/site-packages/pipenv/utils.py", line 1323, in venv_resolve_deps
c = resolve(cmd, sp)
File "/usr/local/lib/python3.7/site-packages/pipenv/utils.py", line 1136, in resolve
result = c.expect(u"\n", timeout=environments.PIPENV_INSTALL_TIMEOUT)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/delegator.py", line 215, in expect
self.subprocess.expect(pattern=pattern, timeout=timeout)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/pexpect/spawnbase.py", line 344, in expect
timeout, searchwindowsize, async_)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/pexpect/spawnbase.py", line 372, in expect_list
return exp.expect_loop(timeout)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/pexpect/expect.py", line 181, in expect_loop
return self.timeout(e)
File "/usr/local/lib/python3.7/site-packages/pipenv/vendor/pexpect/expect.py", line 144, in timeout
raise exc
pexpect.exceptions.TIMEOUT: <pexpect.popen_spawn.PopenSpawn object at 0x7f81e99bec90>
searcher: searcher_re:
0: re.compile('\n')
<pexpect.popen_spawn.PopenSpawn object at 0x7f81e99bec90>
searcher: searcher_re:
0: re.compile('\n')
(app) root#ef80787b5c42:/usr/src/app#

Here are my debugging notes. Still not sure which package is causing the problem, but this does seem to fix it.
The error you get when you first run pipenv install with pipenv version 2020.8.13.
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/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.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/cli/command.py", line 252, in install
site_packages=state.site_packages
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 1928, in do_install
site_packages=site_packages,
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 580, in ensure_project
pypi_mirror=pypi_mirror,
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 512, in ensure_virtualenv
python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 999, in do_create_virtualenv
project._environment.add_dist("pipenv")
File "/usr/local/lib/python3.6/site-packages/pipenv/environment.py", line 135, in add_dist
self.extend_dists(dist)
File "/usr/local/lib/python3.6/site-packages/pipenv/environment.py", line 127, in extend_dists
extras = self.resolve_dist(dist, self.base_working_set)
File "/usr/local/lib/python3.6/site-packages/pipenv/environment.py", line 122, in resolve_dist
deps |= cls.resolve_dist(dist, working_set)
File "/usr/local/lib/python3.6/site-packages/pipenv/environment.py", line 121, in resolve_dist
dist = working_set.find(req)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 642, in find
raise VersionConflict(dist, req)
pkg_resources.VersionConflict: (importlib-metadata 2.0.0 (/usr/local/lib/python3.6/site-packages), Requirement.parse('importlib-metadata<2,>=0.12; python_version < "3.8"'))
If you run pip install -U pipenv it seems to change the importlib-metadata version:
Installing collected packages: importlib-metadata
Attempting uninstall: importlib-metadata
Found existing installation: importlib-metadata 2.0.0
Uninstalling importlib-metadata-2.0.0:
Successfully uninstalled importlib-metadata-2.0.0
Successfully installed importlib-metadata-1.7.0
Now if you run pipenv install -d --skip-lock it will finish. It seems like a library is requiring a version >= importlib-metadata 2.0.
When I pinned the following dependencies it didn't work at first when running pipenv lock, however, if I removed the lock file (rm Pipenv.lock) then it worked when I ran pipenv lock again.
virtualenv = "==20.0.31"
importlib-metadata = "==1.7.0"

Try to remove Pipefile.lock before installing a package

I had the same problem when creating a virtual environment using python 3.7.12. The problem is gone using python 3.8.10. On Ubuntu 20.04.4 LTS.

Here are some steps we followed, while we faced "locking failed"
1.make env
2.source /etc/pyenv
3.pipenv install
4.pipenv graph
5. Shoot the respective testcase execution (it may vary based on requirements)
Hope it works!!!:)

Just delete the Pipfile.lock then rerun pipenv lock.

Related

pip3 crashing with "start() missing 1 required positional argument: 'sessionID'"

MacOS 11.6, Python 3.9
This behavior is new. I probably used pip successfully a month or two ago. Since that time I have worked with brew, but nothing that should have messed with the installation of Python or pip themselves. Happens in response to any pip3 install command. Any clues?
% python3 -m pip install --upgrade pip
Requirement already satisfied: pip in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (22.2.2)
Collecting pip
Downloading pip-22.3.1-py3-none-any.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/2.1 MB ? eta -:--:--ERROR: Exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
status = run_func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
return func(self, options, args)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 369, in run
requirement_set = resolver.resolve(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
result = self._result = resolver.resolve(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 348, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/resolvelib/structs.py", line 151, in __bool__
return bool(self._sequence)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__
return any(self)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 97, in _iter_built_with_inserted
candidate = func()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 206, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 297, in __init__
super().__init__(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 162, in __init__
self.dist = self._prepare()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 231, in _prepare
dist = self._prepare_distribution()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 308, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 438, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 483, in _prepare_linked_requirement
local_file = unpack_url(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 165, in unpack_url
file = get_http_url(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 106, in get_http_url
from_path, content_type = download(link, temp_dir.path)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/network/download.py", line 147, in __call__
for chunk in chunks:
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py", line 52, in _rich_progress_bar
with progress:
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/rich/progress.py", line 1165, in __enter__
self.start()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/rich/progress.py", line 1156, in start
self.live.start(refresh=True)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/rich/live.py", line 132, in start
self._refresh_thread.start()
TypeError: start() missing 1 required positional argument: 'sessionID'
[notice] A new release of pip available: 22.2.2 -> 22.3.1
[notice] To update, run: pip install --upgrade pip

How to solve a problem while trying install a pipenv with python 3.11?

Preconditions:
python 3.11
pipenv 2022.12.19
Problem:
I want to create a new pipenv virtual environment for my project with command:
pipenv --python 3.11
or
pipenv --python /usr/bin/python3.11
I have the next error:
Loading .env environment variables...
Creating a virtualenv for this project...
Pipfile: /home/dev/geotek-dev/Pipfile
Using /usr/bin/python3.11 (3.11.1) to create virtualenv...
⠇ Creating virtual environment...created virtual environment CPython3.11.1.final.0-64 in 227ms
creator CPython3Posix(dest=/root/.local/share/virtualenvs/geotek-dev-Rxuh4rdd, clear=False, global=False)
seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, pkg_resources=latest, via=copy, app_data_dir=/root/.local/share/virtualenv/seed-app-data/v1.0.1.debian.1)
activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
✔ Successfully created virtual environment!
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 8, in <module>
sys.exit(cli())
^^^^^
File "/usr/local/lib/python3.11/dist-packages/pipenv/vendor/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pipenv/cli/options.py", line 57, in main
return super().main(*args, **kwargs, windows_expand_args=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pipenv/vendor/click/core.py", line 1053, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pipenv/vendor/click/core.py", line 1637, in invoke
super().invoke(ctx)
File "/usr/local/lib/python3.11/dist-packages/pipenv/vendor/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pipenv/vendor/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pipenv/vendor/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pipenv/vendor/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pipenv/cli/command.py", line 210, in cli
ensure_project(
File "/usr/local/lib/python3.11/dist-packages/pipenv/core.py", line 541, in ensure_project
ensure_virtualenv(
File "/usr/local/lib/python3.11/dist-packages/pipenv/core.py", line 474, in ensure_virtualenv
do_create_virtualenv(
File "/usr/local/lib/python3.11/dist-packages/pipenv/core.py", line 1060, in do_create_virtualenv
project._environment = Environment(
^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pipenv/environment.py", line 79, in __init__
self._base_paths = self.get_paths()
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pipenv/environment.py", line 383, in get_paths
c = subprocess_run(command)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pipenv/utils/processes.py", line 75, in subprocess_run
return subprocess.run(
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1901, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/root/.local/share/virtualenvs/geotek-dev-Rxuh4rdd/bin/python'
I have decided that the structure of folder if different than in previous versions of python.
In python 3.9 I have folders bin, lib and pyvenv.cfg
In 3.11 I have lib, local and pyvenv.cfg
/bin/python is inside local folder, not in root level.
What should I configure to work with pipenv normally?

python on an AWS m6g instance

I am trying to install a reasonable python 3 on an AWS m6g instance - this is their latest and greatest, and therein lies the rub. It is an ARM64 box, so there is no anaconda install for that (that I know of). I am installing packages manually via pip3, and after much loading of the requisite system packages, compilers, and so on, things mostly work WITH THE EXCEPTION OF matplotlib, which comes up with (sorry, don't know how to indent all of the below four spaces). Any ideas?
pip3 install matplotlib --user
Collecting matplotlib
Using cached https://files.pythonhosted.org/packages/9c/4b/06f4aa9bef6b5e4f177881b4dedd94faa6e7cb3d95dfaeaa8a1a8b541095/matplotlib-3.2.2.tar.gz
Collecting cycler>=0.10 (from matplotlib)
Using cached https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl
Collecting kiwisolver>=1.0.1 (from matplotlib)
Using cached https://files.pythonhosted.org/packages/62/b8/db619d97819afb52a3ff5ff6ad3f7de408cc83a8ec2dfb31a1731c0a97c2/kiwisolver-1.2.0.tar.gz
Complete output from command python setup.py egg_info:
warning: no files found matching '*.png' under directory 'docs/source'
no previously-included directories found matching '.git'
no previously-included directories found matching 'dist'
no previously-included directories found matching 'build'
no previously-included directories found matching 'docs/build'
zip_safe flag not set; analyzing archive contents...
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/lib/python3.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python3.7/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/lib/python3.7/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-c8bpoixa/cppy-1.1.0/setup.py", line 24, in <module>
'py/solver.cpp',
File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib64/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 218, in run
os.path.join(archive_root, 'EGG-INFO'), self.zip_safe()
File "/usr/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 269, in zip_safe
return analyze_egg(self.bdist_dir, self.stubs)
File "/usr/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 379, in analyze_egg
safe = scan_module(egg_dir, base, name, stubs) and safe
File "/usr/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 416, in scan_module
code = marshal.load(f)
ValueError: bad marshal data (unknown type code)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-6x1f9zgp/kiwisolver/setup.py", line 80, in <module>
cmdclass={'build_ext': BuildExt},
File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 128, in setup
_install_setup_requires(attrs)
File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 123, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/usr/lib/python3.7/site-packages/setuptools/dist.py", line 461, in fetch_build_eggs
replace_conflicting=True,
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 866, in resolve
replace_conflicting=replace_conflicting
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1146, in best_match
return self.obtain(req, installer)
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1158, in obtain
return installer(requirement)
File "/usr/lib/python3.7/site-packages/setuptools/dist.py", line 528, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 672, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 698, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 881, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 1149, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 1135, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python3.7/site-packages/setuptools/sandbox.py", line 253, in run_setup
raise
File "/usr/lib64/python3.7/contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python3.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib64/python3.7/contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python3.7/site-packages/setuptools/sandbox.py", line 166, in save_modules
saved_exc.resume()
File "/usr/lib/python3.7/site-packages/setuptools/sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "/usr/lib/python3.7/site-packages/pkg_resources/_vendor/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3.7/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/lib/python3.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python3.7/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/lib/python3.7/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-c8bpoixa/cppy-1.1.0/setup.py", line 24, in <module>
'py/solver.cpp',
File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib64/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 218, in run
os.path.join(archive_root, 'EGG-INFO'), self.zip_safe()
File "/usr/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 269, in zip_safe
return analyze_egg(self.bdist_dir, self.stubs)
File "/usr/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 379, in analyze_egg
safe = scan_module(egg_dir, base, name, stubs) and safe
File "/usr/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 416, in scan_module
code = marshal.load(f)
ValueError: bad marshal data (unknown type code)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-6x1f9zgp/kiwisolver/
[ec2-user#ip-172-31-71-160 bin]$
Many of the dependencies of matplotlib have had new aarch64 wheels uploaded to pypi.org in the last few months since you posted this question. matplotlib itself doesn't have an aarch64 wheel available yet, but recently a change was merged to build one, so it probably will have one available soon. Even though matplotlib doesn't have a binary wheel published yet, I was able to install it on Ubuntu 20.04. It takes a minute or two to build, but it works:
$ sudo apt update
$ sudo apt install python3-pip
$ sudo pip3 install matplotlib
For completeness, I was able to get a full suite of python data science packages installed on Ubuntu 20.04 Arm with the following Dockerfile. (Just run the apt and pip commands if you aren't using Docker.) It takes a long time to complete since it builds many of these packages from source.
As more python packages begin publishing aarch64 wheels, this should become obsolete.
FROM ubuntu:focal
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
build-essential \
python3-pip \
python3-dev \
libfreetype-dev \
libopenblas64-dev \
mklibs \
libmlpack-dev \
libatlas-base-dev \
liblapack64-dev \
libffi-dev \
gfortran
RUN pip3 install jupyterlab matplotlib numpy pandas seaborn

VersionConflict six 1.5.2 vs. six>=1.6.0' when trying to pip install pystan

I get the following error on installing pystan.
$ pip install pystan
I have ubuntu 14.04 and python 2.7
I have tried few of the mentioned solutions on other similar threads but all of them eventually come down to error code 1 error.
Downloading/unpacking pystan
Downloading pystan-2.15.0.0.tar.gz (25.4MB): 25.4MB downloaded
Running setup.py (path:/tmp/pip_build_ali/pystan/setup.py) egg_info for package pystan
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_ali/pystan/setup.py", line 239, in <module>
setup_package()
File "/tmp/pip_build_ali/pystan/setup.py", line 211, in setup_package
dist = setup(**metadata)
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 321, in __init__
_Distribution.__init__(self, attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 389, in finalize_options
ep.require(installer=self.fetch_build_egg)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2324, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 859, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (six 1.5.2 (/usr/lib/python2.7/dist-packages), Requirement.parse('six>=1.6.0'))
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_ali/pystan/setup.py", line 239, in <module>
setup_package()
File "/tmp/pip_build_ali/pystan/setup.py", line 211, in setup_package
dist = setup(**metadata)
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 321, in __init__
_Distribution.__init__(self, attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 389, in finalize_options
ep.require(installer=self.fetch_build_egg)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2324, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 859, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (six 1.5.2 (/usr/lib/python2.7/dist-packages), Requirement.parse('six>=1.6.0'))
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_ali/pystan
Storing debug log for failure in /tmp/tmpXPB8XS
Any thoughts what might be wrong?
pkg_resources.VersionConflict: (six 1.5.2 (/usr/lib/python2.7/dist-packages), Requirement.parse('six>=1.6.0'))
It's saying that the required six package is outdated, you will need to upgrade it before installing your library.
pip install --upgrade six

pip uninstall fails for egg package

My app is distributed as an .egg file. Users successfully install egg with easy_install
$ sudo easy_install abcdef-1.0.0-py2.7.egg
Unfortunately uninstallation fails:
$ sudo pip uninstall abcdef
Uninstalling abcdef-1.0.0:
/usr/local/lib/python2.7/dist-packages/abcdef-1.0.0-py2.7.egg
Proceed (y/n)? y
Successfully uninstalled abcdef-1.0.0
Traceback (most recent call last):
File "/usr/local/bin/pip", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 233, in main
return command.main(cmd_args)
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 252, in main
pip_version_check(session)
File "/usr/local/lib/python2.7/dist-packages/pip/utils/outdated.py", line 102, in pip_version_check
installed_version = get_installed_version("pip")
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 838, in get_installed_version
working_set = pkg_resources.WorkingSet()
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 644, in __init__
self.add_entry(entry)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 700, in add_entry
for dist in find_distributions(entry, True):
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1949, in find_eggs_in_zip
if metadata.has_metadata('PKG-INFO'):
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1463, in has_metadata
return self.egg_info and self._has(self._fn(self.egg_info, name))
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1823, in _has
return zip_path in self.zipinfo or zip_path in self._index()
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1703, in zipinfo
return self._zip_manifests.load(self.loader.archive)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 1643, in load
mtime = os.stat(path).st_mtime
OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/abcdef-1.0.0-py2.7.egg'
And console script is still present in /usr/local/bin/
$ abcdef
Traceback (most recent call last):
File "/usr/local/bin/abcdef", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3019, in <module>
#_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3003, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 655, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 963, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 849, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'abcdef==1.0.0' distribution was not found and is required by the application
Here my setup.py
from setuptools import setup
setup(
name='abcdef',
version='1.0.0',
packages=['abcdef'],
entry_points={
'console_scripts': [
'abcdef = abcdef.abcdef:main',
],
},
)
How to fix it? Anything is missing in setup.py?
$pip --version
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
$ python --version
Python 2.7.11+

Categories

Resources