Traceback when trying to create an environment w/ interpreter specified by its path
See original GitHub issueCan’t create an environment with the Python interpreter specified on the command-line (don’t know if other options work since I only have py
on my PATH).
Describe your environment
- OS Type: Windows 10
- Python version: 3.6.4
- Pipenv version: 1.11.5
Expected result
A virtual environment is created.
Actual result
An exception was raised.
Steps to replicate
> py -3 -m pipenv --python C:\Users\brcan\AppData\Local\Programs\Python\Python36\python.exe
Creating a virtualenv for this project…
Using C:\Users\brcan\AppData\Local\Programs\Python\Python36\python.exe to create virtualenv…
Already using interpreter C:\Users\brcan\AppData\Local\Programs\Python\Python36\python.exe
Using base prefix 'C:\\Users\\brcan\\AppData\\Local\\Programs\\Python\\Python36'
New python executable in C:\Users\brcan\.virtualenvs\bunk-M_X9FcBv\Scripts\python.exe
Installing setuptools, pip, wheel...done.
Virtualenv location:
Traceback (most recent call last):
File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\__main__.py", line 4, in <module>
cli()
File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\vendor\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\vendor\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\vendor\click\core.py", line 1043, in invoke
return Command.invoke(self, ctx)
File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\vendor\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\vendor\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\vendor\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\cli.py", line 154, in cli
core.ensure_project(three=three, python=python, warn=True, site_packages=site_packages)
File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\core.py", line 638, in ensure_project
crayons.green(shorten_path(path_to_python))
File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\core.py", line 698, in shorten_path
short = os.sep.join([s[0] if len(s) > (len('2long4')) else s for s in location.split(os.sep)])
AttributeError: 'NoneType' object has no attribute 'split'
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Problem: Unable to use the ArcPy module - Esri Support
Cause. The path defined in Environment Variables follows the latest installation of Python by default. So, if Python 3.7 is installed after ...
Read more >Trying to configure a python interpreter in eclipse, using the ...
1 Answer 1 ... Try do execute a test Python command e.g. "python --version" from Python installation to see that Python executes well....
Read more >Understanding the Python Path Environment Variable in Python
Pythonpath is a special environment variable that provides guidance to the Python interpreter about where to find various libraries and ...
Read more >1. Command line and environment — Python 3.11.1 ...
When called with -m module-name , the given module is located on the Python module path and executed as a script. In non-interactive...
Read more >Invalid Syntax in Python: Common Reasons for SyntaxError
Note that the traceback message locates the error in line 5, not line 4. The Python interpreter is attempting to point out where...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think I’ve got it. The problem is not Windows-specific, but happens when you don’t have any
python
command available inPATH
at all. Un*x systems typically always have a system-widepython
, which is likely why no-one found out until now.No problem about the breakage; I realize I’m trailblazing here. 😄 I’m happy to keep trying and filing issues as I come across them to help out, so no hard feelings at all on my end.
As for writing the test, I will see if I can find the time but I unfortunately can’t make any promises ATM (I’m still playing catch-up with stuff that backed up from our latest release of VS Code which added pipenv support 😉 ).