Reputation: 25
UPDATE: The issue comes from the special characters in the path where the .virtualenv directory is created. I fixed it by rerouting the .virtualenv in C: and will eventually edit the username to avoid this issue in the future.
I am having some trouble with "pipenv run" on my work laptop (windows pro) and can't seem to find an explanation to my issue. For example, I create a test directory on the desktop in which I put a basic scripts that prints "Hello".
I initiate pipenv in the project folder and it works fine, I can fire up the shell, install packages, run the script (While in the shell), etc..
However, I get a traceback whenever I try to run the script from the main command prompt as such (not inside of pipenv shell):
C:\Users\jérôme\Desktop\tester> pipenv run python testit.py
some other details:
Traceback Error...
Traceback (most recent call last):
File "c:\users\jérôme\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\jérôme\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\jérôme\Python37\Scripts\pipenv.exe\__main__.py", line 7, in <module>
File "c:\users\jérôme\python37\lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "c:\users\jérôme\python37\lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "c:\users\jérôme\python37\lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\jérôme\python37\lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\jérôme\python37\lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\users\jérôme\python37\lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "c:\users\jérôme\python37\lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\users\jérôme\python37\lib\site-packages\pipenv\cli\command.py", line 450, in run
command=command, args=args, three=state.three, python=state.python, pypi_mirror=state.pypi_mirror
File "c:\users\jérôme\python37\lib\site-packages\pipenv\core.py", line 2547, in do_run
run_fn(*run_args, **run_kwargs)
File "c:\users\jérôme\python37\lib\site-packages\pipenv\core.py", line 2468, in do_run_nt
p = _launch_windows_subprocess(script)
File "c:\users\jérôme\python37\lib\site-packages\pipenv\core.py", line 2458, in _launch_windows_subprocess
return subprocess.Popen([command] + script.args, **options)
File "c:\users\jérôme\python37\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "c:\users\jérôme\python37\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Upvotes: 1
Views: 1073
Reputation: 7815
The root cause of the problem are the special characters in the user's directory path, where the pipenv's .virtualenv directory is also created by default. The OP reports to have fixed the problem by rerouting the .virtualenv in C:
A quick test in, e.g. c:\tmp
can help to rule out this cause.
Upvotes: 1