I am new to using pipenv virtual environments. I am using one with a Django project. Recently I tried to start the environment with pipenv shell. I got a message that something like there was no environment available even though I have been using it for several months.
I exited the directory and re-entered. Then ran pipenv shell again. This time the env was activated. However when I try to install a package or run pipenv lock --clear I get the following error:
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
Traceback (most recent call last):
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 764, in <module>
main()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 758, in main
_main(parsed.pre, parsed.clear, parsed.verbose, parsed.system, parsed.write,
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 741, in _main
resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 695, in resolve_packages
from pipenv.core import project
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/core.py", line 33, in <module>
from .project import Project
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/project.py", line 30, in <module>
from .vendor.requirementslib.models.utils import get_default_pyproject_backend
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/__init__.py", line 9, in <module>
from .models.lockfile import Lockfile
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/lockfile.py", line 14, in <module>
from ..utils import is_editable, is_vcs, merge_items
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/utils.py", line 8, in <module>
import pip_shims.shims
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/__init__.py", line 26, in <module>
from . import shims
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/shims.py", line 12, in <module>
from .models import (
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 790, in <module>
Command.add_mixin(SessionCommandMixin)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 704, in add_mixin
mixin = mixin.shim()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 752, in shim
result = self.traverse(top_path)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 744, in traverse
result = shim.shim()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 590, in shim
imported = self._import()
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 615, in _import
result = self._import_module(self.calculated_module_path)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/vendor/pip_shims/models.py", line 365, in _import_module
imported = importlib.import_module(module)
File "/Users/mainuser/.pyenv/versions/3.9.2/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/cli/req_command.py", line 15, in <module>
from pipenv.patched.notpip._internal.index.package_finder import PackageFinder
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/index/package_finder.py", line 21, in <module>
from pipenv.patched.notpip._internal.index.collector import parse_links
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_internal/index/collector.py", line 12, in <module>
from pipenv.patched.notpip._vendor import html5lib, requests
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_vendor/requests/__init__.py", line 97, in <module>
from pipenv.patched.notpip._vendor.urllib3.contrib import pyopenssl
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/pipenv/patched/notpip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/Users/mainuser/anaconda/lib/python3.6/site-packages/OpenSSL/rand.py", line 213, in <module>
_lib.ERR_load_RAND_strings()
AttributeError: module 'lib' has no attribute 'ERR_load_RAND_strings'
I am not sure how to interpret this but it looks like python3.6 is being used when the shell and project python version is 3.9.
Any ideas about what is causing this and how to fix it?
Related
I use vscode and I'm working with Jupyter in this particular example. Yesterday, I was doing my work fine. Today, my venv is broken, so I deleted and started again:
python -m venv venv
./venv/Scripts/Activate
Okay, so I have brand new venv now. So lets try updating pip:
python -m pip --upgrade pip
And I get this error:
Traceback (most recent call last):
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_internal\__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_vendor\urllib3\__init__.py", line 7, in <module>
from .connectionpool import (
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 11, in <module>
from .exceptions import (
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_vendor\urllib3\exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 203, in load_module
mod = mod._resolve()
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 115, in _resolve
return _import_module(self.mod)
File "C:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\pip\_vendor\urllib3\packages\six.py", line 82, in _import_module
__import__(name)
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 71, in <module>
import email.parser
ModuleNotFoundError: No module named 'email.parser'
Okay, lets try to ignore this an set up jupyter.
pip install wheel
pip install juypterlab
pip install ipykernel
Then when I try running a cell in that notebook in VSCode I get this error:
Kernel died (code: 1). ModuleNotFoundError: No module named 'email.parser',
Traceback (most recent call last):
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\ipykernel\kernelapp.py", line 22, in <module>
from IPython.core.application import (
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\IPython\__init__.py", line 56, in <module>
from .terminal.embed import embed
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\IPython\terminal\embed.py", line 17, in <module>
from IPython.terminal.ipapp import load_default_config
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\IPython\terminal\ipapp.py", line 28, in <module>
from IPython.core.magics import (
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\IPython\core\magics\__init__.py", line 18, in <module>
from .code import CodeMagics, MacroToEdit
File "c:\Users\jmarshall\source\mdgattribution\venv\lib\site-packages\IPython\core\magics\code.py", line 23, in <module>
from urllib.request import Request, urlopen
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 88, in <module>
import http.client
File "C:\Users\jmarshall\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 71, in <module>
import email.parser
ModuleNotFoundError: No module named 'email.parser'
What the heck is going on here?
Edit1
I've just proven it will error on the 3.8 global interpreter instance, even though I have other notebooks working on that. I've added a screenshot of the project.
You created a package named email, you need to rename it to some other names.
I'm working on a Rally reporting tool for my team in Python, and I'm trying to package it using cx-freeze. I'm getting a ModuleNotFound error, and I'm wondering if it's because pygal isn't supported by cx-freeze (really hoping this isn't the case because I'd have to rewrite a lot of things)
celinaperalta$ /Users/celinaperalta/Documents/NYLTesting/rally-exports/build/exe.macosx-10.9-x86_64-3.7/RallyGUI ; exit;
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cx_Freeze/initscripts/__startup__.py", line 40, in run
module.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cx_Freeze/initscripts/Console.py", line 37, in run
exec(code, {'__name__': '__main__'})
File "RallyGUI.py", line 8, in <module>
File "/Users/celinaperalta/Documents/NYLTesting/rally-exports/build/exe.macosx-10.9-x86_64-3.7/RallyReportTool.py", line 7, in <module>
import pygal
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygal/__init__.py", line 28, in <module>
import pkg_resources
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 959, in <module>
class Environment:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 963, in Environment
self, search_path=None, platform=get_supported_platform(),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 190, in get_supported_platform
plat = get_build_platform()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 395, in get_build_platform
plat = get_platform()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sysconfig.py", line 675, in get_platform
get_config_vars(),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sysconfig.py", line 551, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sysconfig.py", line 422, in _init_posix
_temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
ModuleNotFoundError: No module named '_sysconfigdata_m_darwin_darwin'
cx_freeze does not include all the packages automatically. When you find ModuleNotFoundError, you need to inlcude the module explicitly in your setup like -
build_exe_options = {'packages': ['_sysconfigdata_m_darwin_darwin']}
I am trying to install a software called grizli (https://github.com/gbrammer/grizli/) in a conda environment. In one step I have to install another software called drizzle (https://github.com/gbrammer/drizzle.git). Thís installation always results in a RecursionError. As explained in the installation instructions I run
pip install git+https://github.com/gbrammer/drizzle.git
resulting in
Collecting git+https://github.com/gbrammer/drizzle.git
Cloning https://github.com/gbrammer/drizzle.git to /tmp/pip-req-build-ncjb9u8_
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-ncjb9u8_/setup.py", line 61, in <module>
cmdclassd = register_commands(PACKAGENAME, VERSION, RELEASE)
File "/tmp/pip-req-build-ncjb9u8_/astropy_helpers/astropy_helpers/setup_helpers.py", line 140, in register_commands
from .commands.build_sphinx import AstropyBuildSphinx, AstropyBuildDocs
File "/tmp/pip-req-build-ncjb9u8_/astropy_helpers/astropy_helpers/commands/build_sphinx.py", line 16, in <module>
from sphinx.setup_command import BuildDoc as SphinxBuildDoc
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/sphinx/setup_command.py", line 23, in <module>
from sphinx.application import Sphinx
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/sphinx/application.py", line 34, in <module>
from sphinx.environment import BuildEnvironment
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/sphinx/environment/__init__.py", line 38, in <module>
from sphinx.util.websupport import is_commentable
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/sphinx/util/websupport.py", line 11, in <module>
from sphinxcontrib.websupport.utils import is_commentable # NOQA
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/sphinxcontrib/websupport/__init__.py", line 15, in <module>
from sphinxcontrib.websupport.core import WebSupport # NOQA
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/sphinxcontrib/websupport/core.py", line 17, in <module>
from jinja2 import Environment, FileSystemLoader
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/jinja2/__init__.py", line 33, in <module>
from jinja2.environment import Environment, Template
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/jinja2/environment.py", line 15, in <module>
from jinja2 import nodes
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/jinja2/nodes.py", line 19, in <module>
from jinja2.utils import Markup
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/site-packages/jinja2/utils.py", line 486, in <module>
MutableMapping.register(LRUCache)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/abc.py", line 158, in register
if issubclass(subclass, cls):
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/abc.py", line 209, in __subclasscheck__
ok = cls.__subclasshook__(subclass)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 884, in __extrahook__
if issubclass(subclass, scls):
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 1154, in __subclasscheck__
return super().__subclasscheck__(cls)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/abc.py", line 209, in __subclasscheck__
ok = cls.__subclasshook__(subclass)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 884, in __extrahook__
if issubclass(subclass, scls):
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 1154, in __subclasscheck__
return super().__subclasscheck__(cls)
...
...
...
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/abc.py", line 209, in __subclasscheck__
ok = cls.__subclasshook__(subclass)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 884, in __extrahook__
if issubclass(subclass, scls):
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 1154, in __subclasscheck__
return super().__subclasscheck__(cls)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/abc.py", line 209, in __subclasscheck__
ok = cls.__subclasshook__(subclass)
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 884, in __extrahook__
if issubclass(subclass, scls):
File "/home/username/anaconda3/envs/grizli-dev/lib/python3.6/typing.py", line 1154, in __subclasscheck__
return super().__subclasscheck__(cls)
RecursionError: maximum recursion depth exceeded while calling a Python object
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-ncjb9u8_/
The three points in the code stand for the repetition of the three lines that always appear in the same order and probably cause the RecursionError.
I have already tried different pip versions but it didn't change anything. Does anybody have an idea?
I just got the same issue. The only solution that worked for me was to downgrade sphinx to a version <=1.5.6 as mentioned here: https://github.com/ericmandel/pyds9/issues/53 (note that I already had astro-helpers >=2.0 when I got the issue, so the solution is on downgrading sphinx)
Just do: pip install sphinx==1.5.6
and then hopefully drizzle will install correctly.
I'm using Python 3.4.1 64-bit on a Windows 8.1 machine. Pip has been giving me problems lately, specifically this error:
C:\Users\Charlie\Desktop>pip install wxPython_Phoenix-3.0.3.dev78341-cp34-none-w
in_amd64.whl
Traceback (most recent call last):
File "C:\Python34\Scripts\pip-script.py", line 9, in <module>
load_entry_point('Scipy-stack==14.8.27', 'console_scripts', 'pip')()
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 519, in l
oad_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 2630, in
load_entry_point
return ep.load()
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 2310, in
load
return self.resolve()
File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 2316, in
resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Python34\lib\site-packages\pip\__init__.py", line 13, in <module>
from pip.commands import commands, get_summaries, get_similar_commands
File "C:\Python34\lib\site-packages\pip\commands\__init__.py", line 6, in <mod
ule>
from pip.commands.bundle import BundleCommand
File "C:\Python34\lib\site-packages\pip\commands\bundle.py", line 6, in <modul
e>
from pip.commands.install import InstallCommand
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 5, in <modu
le>
from pip.req import InstallRequirement, RequirementSet, parse_requirements
File "C:\Python34\lib\site-packages\pip\req\__init__.py", line 4, in <module>
from .req_set import RequirementSet, Requirements
File "C:\Python34\lib\site-packages\pip\req\req_set.py", line 9, in <module>
from pip.download import (url_to_path, unpack_url)
ImportError: cannot import name 'unpack_url'
This occurs every time I try to install any package. Has anyone had this problem before?
I used: easy_install -U pip
problem solved
Well, obviously there is an error with pip and unpack_url is probably use to download packages from PyPi. I suggest reinstalling by executing this script.
Problem using MySQLdb after installing MySQLdb-python. I followed the instructions I followed the instruction that had me delete the build and delete the egg then modify the my_config and then run the install again. I also tried installing the 64 bit version still no luck
Traceback (most recent call last):
File "/Users/nick.leclair/Documents/Aptana Studio 3 Workspace/Tester/driveByScript.py", line 1, in <module>
import MySQLdb
File "build/bdist.macosx-10.9-intel/egg/MySQLdb/__init__.py", line 19, in <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.9-intel/egg/_mysql.py", line 4, in __bootstrap__
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 882, in resource_filenameself, resource_name
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1351, in get_resource_filename self._extract_resource(manager,self._eager_to_zip(name))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1382, in _extract_resource outf, tmpnam = _mkstemp(".$extract", dir=os.path.dirname(real_path))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2576, in _mkstemp
from tempfile import mkstemp
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 35, in <module>
ImportError: cannot import name Random
Problem solved, it was problem with Aptana not picking up the new library.