-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows embeddable throws FileNotFoundError #2368
Comments
Creating an empty |
@reksar
But if i try to use my custom pkg inside the activated py File "C:\Users\tester\Downloads\testEnv1\lib\site-packages\dateparser\__init__.py", line 3, in <module>
from .date import DateDataParser
File "C:\Users\tester\Downloads\testEnv1\lib\site-packages\dateparser\date.py", line 9, in <module>
from dateparser.date_parser import date_parser
File "C:\Users\tester\Downloads\testEnv1\lib\site-packages\dateparser\date_parser.py", line 5, in <module>
from .conf import apply_settings
File "C:\Users\tester\Downloads\testEnv1\lib\site-packages\dateparser\conf.py", line 6, in <module>
from .parser import date_order_chart
File "C:\Users\tester\Downloads\testEnv1\lib\site-packages\dateparser\parser.py", line 13, in <module>
from dateparser.utils.strptime import strptime
File "C:\Users\tester\Downloads\testEnv1\lib\site-packages\dateparser\utils\strptime.py", line 57, in <module>
__strptime = patch_strptime()
File "C:\Users\tester\Downloads\testEnv1\lib\site-packages\dateparser\utils\strptime.py", line 28, in patch_strptime
_strptime_spec.loader.exec_module(_strptime)
AttributeError: 'zipimporter' object has no attribute 'exec_module' Note: The python Maybe the delivered dlls only work with python |
I can't to find the difference between 3.9 and 3.10 behaviors. Note that in the embeddable Python std lib is zipped and you have problem with |
Ha! Deprecated since Python 3.10. Use exec_module() instead. It seems you need to add a hack for old |
All I can help is to automatically create the |
Maybe this can be added to the docs? 🤔 |
Hm, where exactly? Looks like everything is in place.
|
Sry i thought Before https://docs.python.org/3.10/library/zipimport.html#zipimport.zipimporter.exec_module |
Yes, this is not a virtualenv problem. But initially you got the error because the Or just ignore it absence when creating the virtual environment🤔 |
Maybe ignore only if embedded python is used? In the other case the error would you point to the right direction. |
I feel I should reiterate my point from #1774 (comment) - the embedded Python distribution is not intended for this sort of use, and I don't think virtualenv should add support for being used with it. It's worth pointing out that the embedded distribution doesn't include the stdlib venv module, indicating fairly clearly that it's not intended as a base for creating virtual environments from. If you want a portable Python environment that can be used like this, maybe what you actually want is the nuget package? |
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
but we make
and we install Are we insane? Yes! Does it hurt someone?) |
Sure 🙂 But if it breaks, you're on your own. Of course it's down to @gaborbernat whether he wants to support this. If it was my choice, though, I wouldn't. |
This dir can be missing in some Python distributions, e.g. in the embeddable Python for Windows. This fix prevents the error described in pypa#2368 Also fixes tests that were broken by prev commit.
@pfmoore Call it a non-standard use case if you like) All we do is:
|
The PR has been now merged. |
Issue
Using the latest (
20.15.0
) version ofvirtualenv
together with python 3.9 Windows embeddable package throws aFileNotFoundError
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 thevirtualenv
module. Am i missing any step?Note: the unzipped
python
folder does not contain anyDLLs
subfolder.(Tested with latest python
3.9
and3.10
.)Environment
Provide at least:
pip list
of the host python wherevirtualenv
is installed:Output of the virtual environment creation
Make sure to run the creation with
-vvv --with-traceback
:The text was updated successfully, but these errors were encountered: