ClimenteA/pyvan

bug? pyvan reports tomllib as an Import not found locally, and then tries to download from PyPI - but is built-in for Python 3.11

Closed this issue · 5 comments

This seems to be a bug:

pyvan reports tomllib as an Import not found locally, and then tries to download from PyPI - but is built-in for Python 3.11

===START PYVAN BUILD===
Resolved python_version 3.11.6: (3, 11, 6)
Using Python-3.11.6 from:
 C:\Users\Sean.Ryan\Downloads\get-pip.py
 C:\Users\Sean.Ryan\Downloads\python-3.11.6-embed-amd64.zip
Searching modules needed using 'pipreqs'...
Running command:  pipreqs C:\sean\src\mx\my-app\src --force --ignore main-exe --savepath C:\sean\src\mx\my-app\dist\my-app-v1.15.1\main-exe\requirements.txt
WARNING: Import named "tomllib" not found locally. Trying to resolve it at the PyPI server.
WARNING: Package "tomllib" does not exist or network problems
INFO: Successfully saved requirements file in C:\sean\src\mx\my-app\dist\my-app-v1.15.1\main-exe\requirements.txt
b''
Done!

But expect that pyvan sees tomllib as a built-in module for Python 3.11, so no need to try to find or download from PyPI ?

The used embedded python is a bit different. It doesn't have some packages (tkinter and some other I don't remember).

Package tomllib may be one of those missing packages from the embedded python.

Add this package to requirements: https://pypi.org/project/toml/ or manually copy/paste the tomlib package into resulted output of pyvan (I think is site-packages).

One of the advantage of using pyvan is that you can debug anything if something goes wrong (unlike pyinstaller where this is harder to do so). The result is just the embeded python + your scripts.

hi -
are not toml and tomllib two different modules?

I am using tomllib which is built in.

Far as i can tell, the pyvan output works ok (no missing modules or packages)

So the warning about tomllib missing seems to be a false positive

macOS
I am getting this FileNotFoundError dist/python31.zip
I see dist/python312.zip

Uncommented 'import site' line from '/Users/nik/testgithubrepos/flaskwebgui/examples/flask-desktop/dist/python31._pth' file
Extracting /Users/nik/testgithubrepos/flaskwebgui/examples/flask-desktop/dist/python31.zip file
Traceback (most recent call last):
  File "/Users/nik/testgithubrepos/flaskwebgui/examples/flask-desktop/van.py", line 9, in <module>
    pyvan.build(**OPTIONS)
  File "/Users/nik/Library/Python/3.9/lib/python/site-packages/pyvan.py", line 426, in build
    prepare_for_pip_install(
  File "/Users/nik/Library/Python/3.9/lib/python/site-packages/pyvan.py", line 124, in prepare_for_pip_install
    zip_ref = zipfile.ZipFile(zip_pyfile, 'r')
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/zipfile.py", line 1239, in __init__
    self.fp = io.open(file, filemode)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/nik/testgithubrepos/flaskwebgui/examples/flask-desktop/dist/python31.zip'

I specified in the docs also - unfortunalty pyvan doesn't work on linux and mac (only windows).

I don't have a Macbook to try to make it work there.. if you want you can contribute to this project.

closing
pipreqs throws sometimes a false positive - the output of pyvan seems to work