fbs icon indicating copy to clipboard operation
fbs copied to clipboard

No such file or directory: 'c:\\test_project\\venv\\scripts\\pyinstaller.exe\\__main__.pyo'

Open xOctave opened this issue 6 years ago • 20 comments

Hello,

I encounter a problem when running fbs freeze on a test project with just a few dependencies. The process stops stating that it cannot find pyinstaller.exe\__main__.pyo

FileNotFoundError: [Errno 2] No such file or directory: 'c:\\test_project\\venv\\scripts\\pyinstaller.exe\\__main__.pyo'

I read all the documentation and troubleshooting carefully, and solved all my dependencies problem by myself.

My setup

  • operating system(s) Windows 10
  • Python version 3.6 vanilla
  • fbs 0.83
  • PyInstaller 3.5
  • PyQt5 5.13.0

PS - Thanks a lot for this awesome fbs stack by the way.

xOctave avatar Jul 25 '19 14:07 xOctave

Interesting. Some other people reported this - with fbs - on PyInstaller's issue tracker. I'll have a look when I find time.

mherrmann avatar Jul 25 '19 14:07 mherrmann

@hsq125 do you have a minimal example that reproduces the problem?

mherrmann avatar Jul 25 '19 14:07 mherrmann

Thanks a lot for answering. Yes, I also found https://github.com/pyinstaller/pyinstaller/issues/3977.

I'll try to clean up my project just right now to create a minimal example.

xOctave avatar Jul 25 '19 15:07 xOctave

@mherrmann Here is a minimal example fbs-freeze.zip

It looks like adding any dependency to a empty project leads to the issue.

Here is the procedure I followed to create the minimal project and reproduce the problem

  1. Create project folder, for example fbs-freeze
  2. Go in folder fbs-freeze
  3. Create virtual environment with python -m venv v1
  4. Activate virt env v1\Script\activate.bat
  5. fbs startproject
  6. So far, everything will be OK - if you run fbs freeze --debug, it will finish and produce an .exe
  7. add import numpy in main.py, and run fbs freeze --debug again -> it will produce the reported error.
  8. remove the import line, and it is working again.

Additionnal info, my virtual environment is (v1) C:\fbs-freeze>pip list --local Package Version numpy 1.16.4 pip 18.1 PyQt5 5.13.0 PyQt5-sip 4.19.18 setuptools 40.6.2

Thanks for your help!

xOctave avatar Jul 25 '19 15:07 xOctave

@rich678s Do you really expect me to read through all this output? Paste a minimal example that reproduces the problem here, or ask on StackOverflow. This space is for bugs in fbs, not "I have a problem with my script". Unless you can convince me that what you are experiencing is a bug in fbs, and not a problem of your code, I have better things to do in my spare time than to help you.

mherrmann avatar Jul 27 '19 18:07 mherrmann

I guess I was a bit too harsh in my reply, sorry. I hadn't considered the context. But still, I feel like your message lacks a lot of context. The fact that you have openpyxl in there shows that it's a dump from your project, not from @hsq125's minimal example. It's too little information (and in too much text) for me to be able to help you.

mherrmann avatar Jul 27 '19 18:07 mherrmann

@mherrmann If I may suggest an hypothesis -> I think that the problem arise as soon as you add a dependency in the project, whatever it is (could be pillow, numpy, six ... whatever).

I went through the output of the "fbs freeze --debug", and I see (maybe you will say that it is obvious) that the freeze command is doing additional things when the project include external dependencies.

The problem is located in this part of the code (maybe in the PyInstaller hooks provided by fbs?) I'm really not an expert in that - I try to debug it, but without success so far :(

xOctave avatar Jul 27 '19 21:07 xOctave

unfortunately I do not have a minimum working example. for me fbs freeze works normally, but when I do fbs freeze --debug I get this error. If I can't find a solution I'll come up with a minimal example and post it here.

Edit:I made a quick edit to the pip install files to follow the advice given here: https://github.com/pyinstaller/pyinstaller/issues/3977#issuecomment-453482865 this eliminated the error.

Aperion avatar Aug 01 '19 18:08 Aperion

@hsq125 I cannot reproduce the problem. Here's what I tried:

OS: WIndows 7 Python 3.6

python -m venv venv
call venv\Scripts\activate.bat
pip install fbs PyQt5==5.9.2 numpy==1.16.2
fbs startproject
# Add `import numpy` to src/main/python/main.py
fbs freeze --debug
target\MyApp\MyApp

No problems.

mherrmann avatar Aug 05 '19 07:08 mherrmann

@mherrmann Given your example I do get the error, however I am running Python 3.7. I edit venv/Lib/site-packages/fbs/freeze/__init__.py to the following: https://gist.github.com/Aperion/daf314c286a94ec5e41e01b5b79ef8b8

After such a time called fbs freeze --debug gets the same error, but replace pyinstaller with fbs if I instantiate fbs via python -m fbs freeze --debug everything works fine. it seams there two issues are related.

Aperion avatar Aug 06 '19 21:08 Aperion

I'm afraid I don't quite understand your comment @Aperion. And I don't want to spend further time thinking about it, because you are using Python 3.7, which I do not yet support. Feel free to post back here if you have information about the supported Python versions 3.5 and 3.6.

mherrmann avatar Aug 07 '19 06:08 mherrmann

@mherrmann When I import the pytz library. I got a similar error.

System Configuration

operating system(s) Windows 10 Python version 3.6 fbs 0.8.3 PyInstaller 3.5 PyQt5 5.9.2 pytz 2019.2

Akashpanchal95 avatar Aug 07 '19 09:08 Akashpanchal95

@Akashpanchal95 Do you also get this error with PyInstaller 3.4 and if you repeat these steps with pytz instead of numpy?

mherrmann avatar Aug 07 '19 09:08 mherrmann

I have checked with PyInstaller 3.4. Now it's working. Thanks for your help.

Akashpanchal95 avatar Aug 07 '19 09:08 Akashpanchal95

I have checked with PyInstaller 3.4. Now it's working.

And this, to everyone reading this, is why I'm so adamant about only using officially supported versions with fbs. At the time of this writing:

  • Python 3.5 or 3.6
  • PyInstaller 3.4
  • PyQt5 5.9.2

Everything else is unsupported and can (and often does) lead to problems.

mherrmann avatar Aug 07 '19 09:08 mherrmann

I got same issues with @hsq125 @Aperion. Python 3.6 Pyinstaller 3.4, fbs 0.8.3.

Firstly, everything is fine. When i got "datashader" package installed, fbs run was ok, but failed to freeze, even I didn't import datashader. Once i uninstalled datashader and it's dependency(numba, xarrays, too much), everything go back fine.

The dependency list that i uninstalled
> certifi==2019.6.16
> chardet==3.0.4
> Click==7.0
> cloudpickle==1.2.1
> colorcet==2.0.1
> dask==2.2.0
> datashader==0.7.0
> datashape==0.5.2
> decorator==4.4.0
> distributed==2.2.0
> fsspec==0.4.1
> HeapDict==1.0.0
> idna==2.8
> imageio==2.5.0
> llvmlite==0.29.0
> locket==0.2.0
> msgpack==0.6.1
> multipledispatch==0.6.0
> networkx==2.3
> numba==0.45.1
> param==1.9.1
> partd==1.0.0
> psutil==5.6.3
> pyct==0.4.6
> python-dateutil==2.8.0
> PyWavelets==1.0.3
> scikit-image==0.15.0
> scipy==1.3.1
> sortedcontainers==2.1.0
> tblib==1.4.0
> testpath==0.3.1
> toolz==0.10.0
> xarray==0.12.3
> zict==1.0.0

So, i try to using cleaned env with datashader and fbs:

  • startsproject, got a minimal main.py. Run is ok, Freeze is ok.
  • import numpy, datashader... Run is ok, Freeze is finished but fail to excute script, Freeze --debug I got

subprocess.CalledProcessError: xxxxxxx, returned non-zero exit status 1.

  • delete import. Run is ok, Freeze and Freeze --debug is ok.

Actually, except this issue, Fbs working well with Matplotlib, Numpy, pandas....the package that now i am using. Thanks for your great job, I leave this message doesn't means need help, just because I google and jump to Pyinstaller issue 3977, and i find this page.

@mherrmann If I may suggest an hypothesis -> I think that the problem arise as soon as you add a dependency in the project, whatever it is (could be pillow, numpy, six ... whatever).

I went through the output of the "fbs freeze --debug", and I see (maybe you will say that it is obvious) that the freeze command is doing additional things when the project include external dependencies.

The problem is located in this part of the code (maybe in the PyInstaller hooks provided by fbs?) I'm really not an expert in that - I try to debug it, but without success so far :(

liuh886 avatar Aug 24 '19 05:08 liuh886

Same, I import numpy and the error happens

nfathoni79 avatar Aug 26 '19 19:08 nfathoni79

I meet the problem with PyInstaller 3.5 on Windows, after downgrade to 3.4, it is OK.

Honghe avatar Sep 06 '19 01:09 Honghe

After having tested the two approaches for packaging a python app - with fbs, or with pyinstaller only, I would advice to stick to pyinstaller only.

There is actually no real difficulty in packaging a Qt app, although otherwise stated. Maybe not always using the very latest minor version of Qt, but it works.

Using fbs prevents to use the last versions of python because they are not "supported", which is a big problem. When you start a project, you just want to use the latest version of python, or at least have the choice to fit the other (more) important constraints.

xOctave avatar Sep 13 '19 20:09 xOctave

BTW this appears to be the same issue pyinstaller was facing. I worked around it by using the module instead of the exe. so running python -m fbs freeze instead of fbs freeze is an acceptable work around for me.

I agree with @hsq125 I gave a run of pyinstaller and it appeared to handle qt quite well. I've also combed through fbs source code and I don't recall any thing QT specific in it.

Aperion avatar Sep 20 '19 18:09 Aperion