Skip to content

Commit

Permalink
depend: Allow pylib detection when not a dependency of python.exe
Browse files Browse the repository at this point in the history
If libpython is not detected uses the dependency checker to look for a
dll matching the pattern pythonXY.dll using the same method as
automated detection.

Checks after automated detection and only on windows systems.

Fixes pyinstaller#3942
  • Loading branch information
Loran425 committed Dec 31, 2018
1 parent 5edb4f7 commit 14b6e65
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions PyInstaller/depend/bindepend.py
Expand Up @@ -872,6 +872,14 @@ def get_python_library_path():
return filename

# Python library NOT found. Resume searching using alternative methods.

# Work around for python venv having VERSION.dll rather than pythonXY.dll
if is_win and 'VERSION.dll' in dlls:
pydll = 'python%d%d.dll' % sys.version_info[:2]
if pydll in PYDYLIB_NAMES:
filename = getfullnameof(pydll)
return filename

# Applies only to non Windows platforms.

if is_unix:
Expand Down

16 comments on commit 14b6e65

@mwangiKibui
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worked out in my pycharm project thanks much

@ericfrederich
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worked for me on Windows with Python 3.7. I wasn't using PyCharm. Just had installed pyinstaller within a virtualenv.

git clone git@some-server.com/some-project.git
cd some-project
py -3.7 -m venv env
env\Scripts\activate
pip install -r requirements.txt
pip install pyinstaller
pyinstaller some-file.spec

@karolyi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ericfrederich same here.

@tincumagic
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
Worked like a charm with venv, python 3.7.2 sqalchemy + PySimpleGUI, Thank you very much!
Please put this inside my pyinstaller as soon as possible.

@Petrowykh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super! Thx

@Loran425
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So glad this is working for everyone, been a little rocky journey at times with learning the ins and outs of contributing to public repos and working with CI. Glad I was able to make things a little bit smoother.

@AokiAhishatsu
Copy link

@AokiAhishatsu AokiAhishatsu commented on 14b6e65 May 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked! (Python 3.7.3 venv + Win10 64bit)
Why isn't this merged yet?

@tincumagic
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excelent! Thanks. Worked. Win8 Python 3.7.2

@TheeChody
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much!

@zhangxudongsteven
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. (Win 10 + Python 3.7.3 + PyCharm)

@ricardj
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it worked! Using VSCode, Python 3.7.3 and virtualenv 16.5.0

@Chris-ParkIT
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally found this - works for me Win 10, Visual Studio, Python 3.7.3

@eddyizm
Copy link

@eddyizm eddyizm commented on 14b6e65 Jul 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Life saver! Same problem as everyone else. Albeit, not using Pycharm, just CLI and VS code.

@dongfanglong2012
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i tried this and it does allow the process to complete but i get "Error loading Python DLL" when trying to launch the resulting exe. does anyone have any ideas how to fix this?

@erkin98
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any update?

@Loran425
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch was over two years ago, I believe there is a develop branch that either implemented this or another method of fixing the Python DLL recognition.
Unfortunately without more information of the existing environment this is a very difficult problem to troubleshoot, for example the original issue only appeared while working with venv not a system wide install and only in 3.7 if I remember correctly.

Please sign in to comment.