AttributeError after running pipenv commands - python

There is an error occured during running pipenv command:
Traceback (most recent call last):
File "c:\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python37\Scripts\pipenv.exe\__main__.py", line 9, in <module>
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python37\lib\site-packages\pipenv\vendor\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python37\lib\site-packages\pipenv\cli\command.py", line 390, in shell
pypi_mirror=state.pypi_mirror,
File "c:\python37\lib\site-packages\pipenv\core.py", line 2156, in do_shell
three=three, python=python, validate=False, pypi_mirror=pypi_mirror,
File "c:\python37\lib\site-packages\pipenv\core.py", line 574, in ensure_project
pypi_mirror=pypi_mirror,
File "c:\python37\lib\site-packages\pipenv\core.py", line 494, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "c:\python37\lib\site-packages\pipenv\core.py", line 397, in ensure_python
path_to_python = find_a_system_python(python)
File "c:\python37\lib\site-packages\pipenv\core.py", line 360, in find_a_system_python
python_entry = finder.find_python_version(line)
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 108, in find_python_version
match = self.windows_finder.find_python_version(
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 63, in windows_finder
self._windows_finder = WindowsFinder()
File "<attrs generated init 4868f44fa19b631f0a86b928e7558f26948d224e>", line 13, in __init__
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 92, in get_versions
py_version = PythonVersion.from_windows_launcher(version_object)
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 417, in from_windows_launcher
creation_dict = cls.parse(launcher_entry.info.version)
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\_vendor\pep514tools\_registry.py", line 75, in __getattr__
raise AttributeError(attr)
AttributeError: version
Pipenv version: 2018.11.26
Python version: 3.7.2
What should I do to fix it?

Related

Using venv on the app for iPad: “Pyto - Python 3“

I want to use a virtualenv for a python project in “Pyto - Python 3”. For create a virtual environment I go to the “Ron module” option in pyto and I type venv venv_name. How can I open the virtualenv and install some modules? With “Ron module” I can’t open the directory of the file activate just typing venv_name/bin/activate or venv_name\Scripts\activate Because the app type automatically the command python -m.
Edit: With pyto I can create the virtualenv whit out problem
I even try to use the module pipenv but this happened:
python -m pipenv shell
Documents/site-packages/pipenv/patched/crayons.py:154: DeprecationWarning: invalid escape sequence \$
"([^-_a-zA-Z0-9!##%&=,/'\";:~`\$\^\*\(\)\+\[\]\.\{\}\|\?\<\>\\]+|[^\s]+)"
Documents/site-packages/pipenv/patched/crayons.py:154: DeprecationWarning: invalid escape sequence \$
"([^-_a-zA-Z0-9!##%&=,/'\";:~`\$\^\*\(\)\+\[\]\.\{\}\|\?\<\>\\]+|[^\s]+)"
Traceback (most recent call last):
File "tmp/PRMFC.repl.py", line 53, in _main_function_no_one_calls_a_function_like_that
runpy._run_module_as_main(module_name)
File "Library/python38/runpy.py", line 195, in _run_module_as_main
return _run_code(code, main_globals, None,
File "Library/python38/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "Documents/site-packages/pipenv/__main__.py", line 5, in <module>
cli()
File "Documents/site-packages/pipenv/vendor/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "Documents/site-packages/pipenv/vendor/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "Documents/site-packages/pipenv/vendor/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "Documents/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "Documents/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "Documents/site-packages/pipenv/vendor/click/decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "Documents/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "Documents/site-packages/pipenv/cli/command.py", line 429, in shell
do_shell(
File "Documents/site-packages/pipenv/core.py", line 2356, in do_shell
ensure_project(
File "Documents/site-packages/pipenv/core.py", line 576, in ensure_project
ensure_virtualenv(
File "Documents/site-packages/pipenv/core.py", line 493, in ensure_virtualenv
if not project.virtualenv_exists:
File "Documents/site-packages/pipenv/project.py", line 271, in virtualenv_exists
if os.path.exists(self.virtualenv_location):
File "Documents/site-packages/pipenv/project.py", line 470, in virtualenv_location
self._virtualenv_location = self.get_location_for_virtualenv()
File "Documents/site-packages/pipenv/project.py", line 294, in get_location_for_virtualenv
return str(get_workon_home().joinpath(self.virtualenv_name))
File "Documents/site-packages/pipenv/utils.py", line 2016, in get_workon_home
mkdir_p(str(expanded_path))
File "Documents/site-packages/pipenv/utils.py", line 1488, in mkdir_p
mkdir_p(head)
File "Documents/site-packages/pipenv/utils.py", line 1488, in mkdir_p
mkdir_p(head)
File "Documents/site-packages/pipenv/utils.py", line 1493, in mkdir_p
os.mkdir(newdir)
PermissionError: [Errno 1] Operation not permitted: '.local'

Why "pipenv install requests" command on windows powershell is showing error? [duplicate]

This question already has answers here:
pipenv Failing to Install Packages
(3 answers)
Closed 1 year ago.
I have already installed python's latest version and pipenv on Windows Powershell. When I try to install requests it is showing this error:
FileNotFoundError: [WinError 2] The system cannot find the file specified
ValueError: Not a valid python path: 'C:/ProgramData/Anaconda3/python.exe'
Full error code:
Traceback (most recent call last):
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 618, in parse_executable
result_version = get_python_version(path)
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\utils.py", line 105, in get_python_version
c = subprocess.Popen(version_cmd, **subprocess_kwargs)
File "c:\python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "c:\python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Python39\Scripts\pipenv.exe\__main__.py", line 7, in <module>
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\python39\lib\site-packages\pipenv\cli\command.py", line 233, in install
retcode = do_install(
File "c:\python39\lib\site-packages\pipenv\core.py", line 1920, in do_install
ensure_project(
File "c:\python39\lib\site-packages\pipenv\core.py", line 576, in ensure_project
ensure_virtualenv(
File "c:\python39\lib\site-packages\pipenv\core.py", line 498, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "c:\python39\lib\site-packages\pipenv\core.py", line 388, in ensure_python
path_to_python = find_a_system_python(python)
File "c:\python39\lib\site-packages\pipenv\core.py", line 350, in find_a_system_python
return next(iter(finder.find_all_python_versions()), None)
File "c:\python39\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 312, in find_all_python_versions
python_version_dict = getattr(self.system_path, "python_version_dict", {})
File "c:\python39\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 120, in system_path
self._system_path = self.create_system_path()
File "c:\python39\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 82, in create_system_path
return pyfinder_path.SystemPath.create(
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 682, in create
instance = instance._run_setup()
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 233, in _run_setup
new_instance = new_instance._setup_windows()
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 411, in _setup_windows
windows_finder = WindowsFinder.create()
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 146, in create
return cls()
File "<attrs generated init pythonfinder.models.windows.WindowsFinder>", line 13, in __init__
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 113, in get_versions
versions[py_version.version_tuple[:5]] = base_dir
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 365, in __getattribute__
result = super(PythonVersion, self).__getattribute__(key)
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 430, in version_tuple
self.patch,
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 375, in __getattribute__
instance_dict = self.parse_executable(executable)
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 620, in parse_executable
raise ValueError("Not a valid python path: %r" % path)
ValueError: Not a valid python path: 'C:/ProgramData/Anaconda3/python.exe'
It seems like you have two different Python distributions installed on your system: the Python 3.9 in C:\Python39\ and the Anaconda Python in C:/ProgramData/Anaconda3/. There is a conflict between them.
I recommend that you use one of them only - the Anaconda or the official Python, and uninstall another.

Error: Directory migrations already exists and is not empty from flask db init

I am using Postgres DB with Flask migration. I have changed a table name and want to upgrade it to my local & then remote.
Init give:
flask db init
Python-dotenv could not parse statement starting at line 4
Python-dotenv could not parse statement starting at line 5
Python-dotenv could not parse statement starting at line 6
Error: Directory migrations already exists and is not empty
Migrate gives:
(env) (base) Daniyal#Daniyals-MacBook-Pro Website % flask db migrate
Python-dotenv could not parse statement starting at line 4
Python-dotenv could not parse statement starting at line 5
Python-dotenv could not parse statement starting at line 6
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/script/revision.py:152: UserWarning: Revision 6ee19758a13a referenced from 6ee19758a13a -> 2e8e5e007c0a (head), empty message is not present
util.warn(
Traceback (most recent call last):
File "/Users/Daniyal/Startup/Website/env/bin/flask", line 8, in <module>
sys.exit(main())
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/flask/cli.py", line 967, in main
cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/flask/cli.py", line 586, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/flask/cli.py", line 426, in decorator
return __ctx.invoke(f, *args, **kwargs)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/flask_migrate/cli.py", line 89, in migrate
_migrate(directory, message, sql, head, splice, branch_label, version_path,
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/flask_migrate/__init__.py", line 96, in wrapped
f(*args, **kwargs)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/flask_migrate/__init__.py", line 210, in migrate
command.revision(config, message, autogenerate=True, sql=sql,
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/command.py", line 214, in revision
script_directory.run_env()
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/script/base.py", line 489, in run_env
util.load_python_file(self.dir, "env.py")
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 98, in load_python_file
module = load_module_py(module_id, path)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/util/compat.py", line 184, in load_module_py
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "migrations/env.py", line 96, in <module>
run_migrations_online()
File "migrations/env.py", line 90, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/runtime/environment.py", line 846, in run_migrations
self.get_context().run_migrations(**kw)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/runtime/migration.py", line 511, in run_migrations
for step in self._migrations_fn(heads, self):
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/command.py", line 190, in retrieve_migrations
revision_context.run_autogenerate(rev, context)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/autogenerate/api.py", line 442, in run_autogenerate
self._run_environment(rev, migration_context, True)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/autogenerate/api.py", line 454, in _run_environment
self.script_directory.get_revisions("heads")
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/script/base.py", line 227, in get_revisions
return self.revision_map.get_revisions(id_)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/script/revision.py", line 321, in get_revisions
resolved_id, branch_label = self._resolve_revision_number(id_)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/script/revision.py", line 501, in _resolve_revision_number
self._revision_map
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/util/langhelpers.py", line 230, in __get__
obj.__dict__[self.__name__] = result = self.fget(obj)
File "/Users/Daniyal/Startup/Website/env/lib/python3.8/site-packages/alembic/script/revision.py", line 156, in _revision_map
down_revision = map_[downrev]
KeyError: '6ee19758a13a'
I am not sure why upgrading such a trivial change to DB's schema has to be such a hassle.
I would really appreciate your help on how I can make such change.

Issue while trying to run $pipenv --python 3.7

I'm having issues while trying to run $pipenv --python 3.7, in this case I am running it while inside my virtual environment. As I see, this could be having trouble with another virtual environment called venvAmazon, thar I don't need or use anymore.
I noticed that, when I created my actual virtual environment, 1. it didn't created a pipfile, 2. It was created in python 2.7. (I do have 3.7 in my pc), 3. It also throws me an error if I try to run outside the venv
Traceback (most recent call last):
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 112, in get_versions
version = PythonVersion.parse(p.name)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 359, in parse
version_dict = parse_python_version(str(version))
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/utils.py", line 86, in parse_python_version
raise InvalidPythonVersion("%s is not a python version" % version_str)
pipenv.vendor.pythonfinder.exceptions.InvalidPythonVersion: venvAmazon is not a python version
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/daniel/.local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
return Command.invoke(self, ctx)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/cli/command.py", line 208, in cli
clear=state.clear,
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/core.py", line 574, in ensure_project
pypi_mirror=pypi_mirror,
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/core.py", line 516, in ensure_virtualenv
ensure_python(three=three, python=python)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/core.py", line 397, in ensure_python
path_to_python = find_a_system_python(python)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/core.py", line 360, in find_a_system_python
python_entry = finder.find_python_version(line)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 113, in find_python_version
return self.system_path.find_python_version(
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 54, in system_path
ignore_unsupported=self.ignore_unsupported,
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 451, in create
ignore_unsupported=ignore_unsupported,
File "<attrs generated init 75e45f144e3d5510d54dd5fca6730b98fa0220a9>", line 38, in __init__
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 116, in __attrs_post_init__
self._setup_pyenv()
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 196, in _setup_pyenv
version_glob_path="versions/*", ignore_unsupported=self.ignore_unsupported
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 156, in create
sort_function=sort_function, version_glob_path=version_glob_path)
File "<attrs generated init 3d06d7bc6a0a13af152279598b774c410bafffe4>", line 17, in __init__
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 114, in get_versions
entry = next(iter(version_path.find_all_python_versions()), None)
AttributeError: 'NoneType' object has no attribute 'find_all_python_versions'
After I tried pip install --upgrade --pre pipenv It gave me another error:
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/core.py", line 541, in ensure_virtualenv
pypi_mirror=pypi_mirror,
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/core.py", line 541, in ensure_virtualenv
pypi_mirror=pypi_mirror,
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/core.py", line 541, in ensure_virtualenv
pypi_mirror=pypi_mirror,
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/core.py", line 535, in ensure_virtualenv
cleanup_virtualenv(bare=True)
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/core.py", line 181, in cleanup_virtualenv
vistir.path.rmtree(project.virtualenv_location)
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/vendor/vistir/path.py", line 433, in rmtree
shutil.rmtree(directory, ignore_errors=ignore_errors, onerror=onerror)
File "/usr/lib/python2.7/shutil.py", line 270, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "/usr/lib/python2.7/shutil.py", line 275, in rmtree
onerror(os.remove, fullname, sys.exc_info())
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/vendor/vistir/path.py", line 494, in handle_remove_readonly
if is_readonly_path(path):
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/vendor/vistir/path.py", line 263, in is_readonly_path
fn = fs_decode(fs_encode(fn))
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/vendor/vistir/compat.py", line 382, in fs_encode
path = _get_path(path)
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/vendor/vistir/compat.py", line 297, in _get_path
if isinstance(path, (six.string_types, bytes)):
RuntimeError: maximum recursion depth exceeded while calling a Python object
It seems this is a currently open issue with pipenv. It might worth trying what they suggest there:
pip install --upgrade --pre pipenv

jupyter notebook showing kernel error w/ Python and virtualenv

I have installed jupyter to my virtualenv. After opening a notebook, I am getting this kernel error:
Traceback (most recent call last):
File "D:\Program Files\Python3.7\Lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "D:\Program Files\Python3.7\Lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\Projects\sample_project\venv37\lib\site-packages\ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "D:\Projects\sample_project\venv37\lib\site-packages\traitlets\config\application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-124>", line 2, in initialize
File "D:\Projects\sample_project\venv37\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "D:\Projects\sample_project\venv37\lib\site-packages\ipykernel\kernelapp.py", line 484, in initialize
self.init_kernel()
File "D:\Projects\sample_project\venv37\lib\site-packages\ipykernel\kernelapp.py", line 389, in init_kernel
user_ns=self.user_ns,
File "D:\Projects\sample_project\venv37\lib\site-packages\traitlets\config\configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "D:\Projects\sample_project\venv37\lib\site-packages\ipykernel\ipkernel.py", line 67, in __init__
kernel = self,
File "D:\Projects\sample_project\venv37\lib\site-packages\traitlets\config\configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "D:\Projects\sample_project\venv37\lib\site-packages\IPython\core\interactiveshell.py", line 679, in __init__
self.init_magics()
File "D:\Projects\sample_project\venv37\lib\site-packages\ipykernel\zmqshell.py", line 593, in init_magics
super(ZMQInteractiveShell, self).init_magics()
File "D:\Projects\sample_project\venv37\lib\site-packages\IPython\core\interactiveshell.py", line 2223, in init_magics
m.NamespaceMagics, m.OSMagics, m.PylabMagics, m.ScriptMagics,
File "D:\Projects\sample_project\venv37\lib\site-packages\IPython\core\magic.py", line 386, in register
m = m(shell=self.shell)
File "D:\Projects\sample_project\venv37\lib\site-packages\IPython\core\magics\osm.py", line 52, in __init__
self.execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
File "D:\Projects\sample_project\venv37\lib\re.py", line 234, in compile
return _compile(pattern, flags)
File "D:\Projects\sample_project\venv37\lib\re.py", line 286, in _compile
p = sre_compile.compile(pattern, flags)
File "D:\Projects\sample_project\venv37\lib\sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "D:\Projects\sample_project\venv37\lib\sre_parse.py", line 930, in parse
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
File "D:\Projects\sample_project\venv37\lib\sre_parse.py", line 426, in _parse_sub
not nested and not items))
File "D:\Projects\sample_project\venv37\lib\sre_parse.py", line 816, in _parse
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "D:\Projects\sample_project\venv37\lib\sre_parse.py", line 426, in _parse_sub
not nested and not items))
File "D:\Projects\sample_project\venv37\lib\sre_parse.py", line 507, in _parse
code = _escape(source, this, state)
File "D:\Projects\sample_project\venv37\lib\sre_parse.py", line 402, in _escape
raise source.error("bad escape %s" % escape, len(escape))
re.error: bad escape \P at position 59
I have updated all packages and also reinstalled jupyter package but it didn't help.
Do you guys know what's the problem?
operating system: Windows 10
python version: 3.7

Categories

Resources