Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Traceback when trying to create an environment w/ interpreter specified by its path

See original GitHub issue

Can’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
  1. OS Type: Windows 10
  2. Python version: 3.6.4
  3. 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\", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\", line 4, in <module>
  File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\vendor\click\", line 722, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\vendor\click\", line 697, in main
    rv = self.invoke(ctx)
  File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\vendor\click\", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\vendor\click\", 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\", line 535, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\vendor\click\", 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\", 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\", line 638, in ensure_project
  File "C:\Users\brcan\AppData\Local\Programs\Python\Python36\lib\site-packages\pipenv\", 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:closed
  • Created 6 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

uranusjrcommented, Mar 9, 2018

I think I’ve got it. The problem is not Windows-specific, but happens when you don’t have any python command available in PATH at all. Un*x systems typically always have a system-wide python, which is likely why no-one found out until now.

brettcannoncommented, Mar 8, 2018

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 😉 ).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found