Skip to content
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

unable to run zippapps with pywin32 #19

Closed
SDAravind opened this issue Mar 25, 2022 · 7 comments
Closed

unable to run zippapps with pywin32 #19

SDAravind opened this issue Mar 25, 2022 · 7 comments

Comments

@SDAravind
Copy link

SDAravind commented Mar 25, 2022

@ClericPy - I struggle to overcome pywin32 issue when using zipapps.

When I installed pywin32 module and package it by runing below command
python -m zipapps -o demo.pyz -m "src.main:main" -d -c -u=* -r .\requirements.txt -a "src"

then running python demo.pyz outside virtual environment or on different machine will produce below error

Traceback (most recent call last):
  File "C:\Users\pythonuser\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\pythonuser\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File ".\demo.pyz\__main__.py", line 101, in <module>
    main()
  File ".\demo.pyz\__main__.py", line 66, in main
    import src.main
  File "F:\myapps\zipapps_cache\demo\src\main.py", line 6, in <module>
    import win32com.client as win32
  File "F:\myapps\zipapps_cache\demo\_zipapps_lazy_pip\3.8_Windows\win32com\__init__.py", line 5, in <module>
    import win32api, sys, os
ModuleNotFoundError: No module named 'win32api'

Do you have any work around this or any suggestions?

@SDAravind SDAravind changed the title pywin32 unable run zippapps with pywin32 Mar 25, 2022
@ClericPy
Copy link
Owner

what's the requirements.txt?

@SDAravind
Copy link
Author

what's the requirements.txt?

anyio==3.5.0
asgiref==3.5.0; python_full_version >= "3.6.1" and python_version >= "3.7"
certifi==2021.10.8; python_full_version >= "3.6.1"
charset-normalizer==2.0.12; python_full_version >= "3.6.1" and python_version >= "3"
click==8.0.4; python_full_version >= "3.6.1" and python_version >= "3.6"
colorama==0.4.4
dnspython==2.2.1; python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.6.1"
email-validator==1.1.3; python_full_version >= "3.6.1"
fastapi==0.75.0; python_full_version >= "3.6.1"
h11==0.13.0; python_full_version >= "3.6.1" and python_version >= "3.6"
httptools==0.2.0
idna==3.3; python_full_version >= "3.6.2" and python_version >= "3.6"
itsdangerous==2.1.2; python_full_version >= "3.6.1" and python_version >= "3.7"
jinja2==3.1.0; python_full_version >= "3.6.1" and python_version >= "3.7"
markupsafe==2.1.1; python_full_version >= "3.6.1" and python_version >= "3.7"
numpy==1.22.3
orjson==3.6.7; python_full_version >= "3.6.1" and python_version >= "3.7"
pandas==1.4.1; python_version >= "3.8"
pydantic==1.9.0; python_full_version >= "3.6.1"
python-dateutil==2.8.2; python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.8"
python-dotenv==0.20.0
python-multipart==0.0.5; python_full_version >= "3.6.1"
pytz==2022.1; python_version >= "3.8"
pywin32==303
pyyaml==5.4.1
requests==2.27.1; python_full_version >= "3.6.1"
six==1.16.0; python_full_version >= "3.6.1" and (python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.8")
sniffio==1.2.0; python_version >= "3.6" and python_full_version >= "3.6.2"
starlette==0.17.1; python_version >= "3.6" and python_full_version >= "3.6.1"
typing-extensions==4.1.1; python_version >= "3.6" and python_full_version >= "3.6.1"
ujson==4.3.0; python_full_version >= "3.6.1" and python_version >= "3.6"
urllib3==1.26.9; python_full_version >= "3.6.1" and python_version < "4"
uvicorn==0.15.0; python_full_version >= "3.6.1"
watchgod==0.8.1
websockets==10.2
zipapps==2022.3.17; python_version >= "3.6"

@SDAravind SDAravind changed the title unable run zippapps with pywin32 unable to run zippapps with pywin32 Mar 25, 2022
@ClericPy
Copy link
Owner

I need to recurrent this issue, wait some minutes.

@ClericPy
Copy link
Owner

ClericPy commented Mar 25, 2022

pywin32 is not a normal pypi lib, I tried pip install pywin32 -t . and failed again.

It's a good question but I can't solve it fast

mhammond/pywin32#1484

@ClericPy
Copy link
Owner

ClericPy commented Mar 25, 2022

I succeed once with the solution mhammond/pywin32#1399

Copy the two dll files in pywin32_system32 folder to win32 folder...

So, that's the special case of pywin32, and zipapps could not do much things.

@SDAravind
Copy link
Author

SDAravind commented Mar 26, 2022

Copying dll files doesn't seem to work. It seems like we need to install pywin32 wherever the application is consumed. It doesn't utilize the pywin32 packed in *.pyz.

@ClericPy
Copy link
Owner

copy dll files to the zipapps cache folder

so, maybe -d mode need a venv usage, I will try something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants