Windows embeddable throws FileNotFoundError
See original GitHub issueIssue
Using the latest (20.15.0
) version of virtualenv
together with python 3.9 Windows embeddable package throws a FileNotFoundError
if calling any module code e.g. python.exe -m virtualenv testEnv
.
While following the issue Windows embedable support #1774 and the depending MR Windows embedable support i though it should now be possible to create and handle any venv
with a windows embeddable python, but after proceeding the mentioned steps i was still not able to use the virtualenv
module. Am i missing any step?
I unzipped the embedded package: https://www.python.org/ftp/python/3.9.13/python-3.9.13-embed-amd64.zip Then I run the get-pip.py: https://bootstrap.pypa.io/get-pip.py Then I uncomment in python39._pth the import statement. Then I add some path to PATH env variable. (add path to python.exe and pip.exe) Then I run pip install virtualenv. Then I tried to call
python.exe -m virtualenv testEnv
Note: the unzipped python
folder does not contain any DLLs
subfolder.
(Tested with latest python 3.9
and 3.10
.)
Environment
Provide at least:
- OS:
C:\Users\tester\Downloads\python-3.9.13-embed-amd64>systeminfo
Host Name: WIN10
OS Name: Microsoft Windows 10 Home
OS Version: 10.0.19043 N/A Build 19043
OS Manufacturer: Microsoft Corporation
...
pip list
of the host python wherevirtualenv
is installed:
C:\Users\tester\Downloads\python-3.9.13-embed-amd64>python -m pip list
Package Version
------------ -------
distlib 0.3.4
filelock 3.7.1
pip 22.1.2
platformdirs 2.5.2
setuptools 62.6.0
six 1.16.0
virtualenv 20.15.0
wheel 0.37.1
Output of the virtual environment creation
Make sure to run the creation with -vvv --with-traceback
:
C:\Users\tester\Downloads\python-3.9.13-embed-amd64>python.exe -m virtualenv testENV --vvv --with-traceback
Traceback (most recent call last):
File "runpy.py", line 197, in _run_module_as_main
File "runpy.py", line 87, in _run_code
File "C:\Users\tester\Downloads\python-3.9.13-embed-amd64\lib\site-packages\virtualenv\__main__.py", line 80, in <module>
run_with_catch() # pragma: no cov
File "C:\Users\tester\Downloads\python-3.9.13-embed-amd64\lib\site-packages\virtualenv\__main__.py", line 65, in run_with_catch
run(args, options, env)
File "C:\Users\tester\Downloads\python-3.9.13-embed-amd64\lib\site-packages\virtualenv\__main__.py", line 18, in run
session = cli_run(args, options, env)
File "C:\Users\tester\Downloads\python-3.9.13-embed-amd64\lib\site-packages\virtualenv\run\__init__.py", line 30, in cli_run
of_session = session_via_cli(args, options, setup_logging, env)
File "C:\Users\tester\Downloads\python-3.9.13-embed-amd64\lib\site-packages\virtualenv\run\__init__.py", line 48, in session_via_cli
parser, elements = build_parser(args, options, setup_logging, env)
File "C:\Users\tester\Downloads\python-3.9.13-embed-amd64\lib\site-packages\virtualenv\run\__init__.py", line 74, in build_parser
CreatorSelector(interpreter, parser),
File "C:\Users\tester\Downloads\python-3.9.13-embed-amd64\lib\site-packages\virtualenv\run\plugin\creators.py", line 15, in __init__
creators, self.key_to_meta, self.describe, self.builtin_key = self.for_interpreter(interpreter)
File "C:\Users\tester\Downloads\python-3.9.13-embed-amd64\lib\site-packages\virtualenv\run\plugin\creators.py", line 25, in for_interpreter
meta = creator_class.can_create(interpreter)
File "C:\Users\tester\Downloads\python-3.9.13-embed-amd64\lib\site-packages\virtualenv\create\via_global_ref\builtin\via_global_self_do.py", line 34, in can_create
cls._sources_can_be_applied(interpreter, meta)
File "C:\Users\tester\Downloads\python-3.9.13-embed-amd64\lib\site-packages\virtualenv\create\via_global_ref\builtin\via_global_self_do.py", line 39, in _sources_can_be_applied
for src in cls.sources(interpreter):
File "C:\Users\tester\Downloads\python-3.9.13-embed-amd64\lib\site-packages\virtualenv\create\via_global_ref\builtin\cpython\cpython3.py", line 67, in sources
for ref in refs:
File "C:\Users\tester\Downloads\python-3.9.13-embed-amd64\lib\site-packages\virtualenv\create\via_global_ref\builtin\cpython\cpython3.py", line 98, in dll_and_pyd
for file in folder.iterdir():
File "pathlib.py", line 1160, in iterdir
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\tester\\Downloads\\python-3.9.13-embed-amd64\\DLLs'
Issue Analytics
- State:
- Created a year ago
- Comments:15 (11 by maintainers)
Creating an empty
DLLs
folder should fix the issue.If you know what you do and it just works - why not?
Most use-cases is simple and portable Python environment. I think closest alternative is PyPy (if you don’t pay attention that this is not CPython), but nuget Python package can be too. But both of these alternatives have stdlib
venv
module, while embedded Python does not. And onlyvirtualenv
can help in this case.but we make
pip
workand we install
virtualenv
throughpip
Are we insane? Yes! Does it hurt someone?)