Python Forum
PyInstaller on Mac ... does not work easily? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: PyInstaller on Mac ... does not work easily? (/thread-31036.html)

Pages: 1 2


PyInstaller on Mac ... does not work easily? - mu234 - Nov-19-2020

Hello All!

I am new to this forum, however, I like the forums very much because I learn :)

I am having a problem with a pyinstaller, somehow, I get an error:

Last login: Thu Nov 19 11:50:46 on ttys001
mkdir: /Users/.../.bash_sessions: Operation not permitted
...SM_Python/build/simple/simple ; exit;
MU234s-iMac:~ mu234$ /Users/.../Desktop/Python\ delam/SM_Python/build/simple/simple ; exit;
[4606] Error loading Python lib '/Users/.../Desktop/Python delam/SM_Python/build/simple/Python': dlopen: dlopen(/Users/.../Desktop/Python delam/SM_Python/build/simple/Python, 10): image not found
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]
Any idea why I do not have the permissions? I have ran the pyinstaller as SUDO : sudo pyinstaller simple.py, in addition, there is a problem with finding a python Lib? Not sure what that is?

Anyway, I am on MAC and if I run the script in terminal : python ....py works like a charm. Wondering what is going on.

Anyway, what can I do to properly have the standalone app?

Best.


RE: PyInstaller on Mac ... does not work easily? - snippsat - Nov-19-2020

What version of Python are you running,the path look a little strange.
Look at The right and wrong way to set Python 3 as default on a Mac
So recently pyinstaller is now also updated for Python 3.9.

Should not need to run pyinstaller as sudo.
Not sure on permissions setup Mac,can make a virtual environment(build into python) that should fix permissions issues.

Quick demo.
tom@tom-VirtualBox:~$ python -V
Python 3.8.5
tom@tom-VirtualBox:~$ pip -V
pip 20.2.3 from /home/tom/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pip (python 3.8)

# Make 
tom@tom-VirtualBox:~$ python -m venv py_env

# cd in
tom@tom-VirtualBox:~$ cd py_env

# Activate 
tom@tom-VirtualBox:~/py_env$ source bin/activate

# Install
(py_env) tom@tom-VirtualBox:~/py_env$ pip install pyinstaller
Collecting pyinstaller
  Downloading pyinstaller-4.1.tar.gz (3.5 MB) .....
  
Successfully installed altgraph-0.17 pyinstaller-4.1 pyinstaller-hooks-contrib-2020.10

# Now will pyisntaller run from this folder
(py_env) tom@tom-VirtualBox:~/py_env$ which pyinstaller
/home/tom/py_env/bin/pyinstaller



RE: PyInstaller on Mac ... does not work easily? - mu234 - Nov-20-2020

python 3.9

will have a look at what you are saying ... thanks!

(Nov-19-2020, 03:06 PM)snippsat Wrote: What version of Python are you running,the path look a little strange.
Look at The right and wrong way to set Python 3 as default on a Mac
So recently pyinstaller is now also updated for Python 3.9.

Should not need to run pyinstaller as sudo.
Not sure on permissions setup Mac,can make a virtual environment(build into python) that should fix permissions issues.

Quick demo.
tom@tom-VirtualBox:~$ python -V
Python 3.8.5
tom@tom-VirtualBox:~$ pip -V
pip 20.2.3 from /home/tom/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pip (python 3.8)

# Make 
tom@tom-VirtualBox:~$ python -m venv py_env

# cd in
tom@tom-VirtualBox:~$ cd py_env

# Activate 
tom@tom-VirtualBox:~/py_env$ source bin/activate

# Install
(py_env) tom@tom-VirtualBox:~/py_env$ pip install pyinstaller
Collecting pyinstaller
  Downloading pyinstaller-4.1.tar.gz (3.5 MB) .....
  
Successfully installed altgraph-0.17 pyinstaller-4.1 pyinstaller-hooks-contrib-2020.10

# Now will pyisntaller run from this folder
(py_env) tom@tom-VirtualBox:~/py_env$ which pyinstaller
/home/tom/py_env/bin/pyinstaller



RE: PyInstaller on Mac ... does not work easily? - mu234 - Nov-20-2020

Interestingly! I have a problem with get a version of pip, have a look at the output when I type $pip -V

MU234s-iMac:~ mu234$ python -V
Python 3.9.0

MU234s-iMac:~ mu234$ pip -V
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/Users/mu234/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 3251, in <module>
@_call_aside
File "/Users/mu234/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 3235, in _call_aside
f(*args, **kwargs)
File "/Users/mu234/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/Users/mu234/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 583, in _build_master
ws.require(__requires__)
File "/Users/mu234/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/Users/mu234/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==20.2.4' distribution was not found and is required by the application
MU234s-iMac:~ mu234$

I guess I have to reinstall the pip...

(Nov-20-2020, 10:21 AM)mu234 Wrote: python 3.9

will have a look at what you are saying ... thanks!

(Nov-19-2020, 03:06 PM)snippsat Wrote: What version of Python are you running,the path look a little strange.
Look at The right and wrong way to set Python 3 as default on a Mac
So recently pyinstaller is now also updated for Python 3.9.

Should not need to run pyinstaller as sudo.
Not sure on permissions setup Mac,can make a virtual environment(build into python) that should fix permissions issues.

Quick demo.
tom@tom-VirtualBox:~$ python -V
Python 3.8.5
tom@tom-VirtualBox:~$ pip -V
pip 20.2.3 from /home/tom/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pip (python 3.8)

# Make 
tom@tom-VirtualBox:~$ python -m venv py_env

# cd in
tom@tom-VirtualBox:~$ cd py_env

# Activate 
tom@tom-VirtualBox:~/py_env$ source bin/activate

# Install
(py_env) tom@tom-VirtualBox:~/py_env$ pip install pyinstaller
Collecting pyinstaller
  Downloading pyinstaller-4.1.tar.gz (3.5 MB) .....
  
Successfully installed altgraph-0.17 pyinstaller-4.1 pyinstaller-hooks-contrib-2020.10

# Now will pyisntaller run from this folder
(py_env) tom@tom-VirtualBox:~/py_env$ which pyinstaller
/home/tom/py_env/bin/pyinstaller



RE: PyInstaller on Mac ... does not work easily? - mu234 - Nov-20-2020

ok, but when I try to install the pip I get the following :

Output:
MU234s-iMac:~ mu234$ sudo easy_install pip Password: Traceback (most recent call last): File "/usr/bin/easy_install-2.7", line 7, in <module> from pkg_resources import load_entry_point File "/Users/mu234/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 3251, in <module> @_call_aside File "/Users/mu234/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 3235, in _call_aside f(*args, **kwargs) File "/Users/mu234/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/Users/mu234/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 585, in _build_master return cls._build_from_requirements(__requires__) File "/Users/mu234/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements dists = ws.resolve(reqs, Environment()) File "/Users/mu234/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 786, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'setuptools==18.5' distribution was not found and is required by the application MU234s-iMac:~ mu234$



RE: PyInstaller on Mac ... does not work easily? - mu234 - Nov-20-2020

OK, it seems I have two versions of Python, and the default is Python 2.7 ...

Output:
MU234s-iMac:~ mu234$ python -V Python 2.7.16 MU234s-iMac:~ mu234$ python3 -V Python 3.9.0 MU234s-iMac:~ mu234$



RE: PyInstaller on Mac ... does not work easily? - mu234 - Nov-20-2020

In addition, I do not have the pip :/

Output:
MU234s-iMac:~ mu234$ sudo easy_install pip sudo: unable to execute /Library/Frameworks/Python.framework/Versions/3.9/bin/easy_install: No such file or directory



RE: PyInstaller on Mac ... does not work easily? - mu234 - Nov-20-2020

OK, solved the problem with PIP with the "python3 get-pip.py" and now I have the pip version

Output:
MU234s-iMac:~ mu234$ pip -V pip 20.2.4 from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9)



RE: PyInstaller on Mac ... does not work easily? - mu234 - Nov-20-2020

... and pyinstaller version is 4.0

Output:
MU234s-iMac:~ mu234$ pyinstaller -v 4.0 MU234s-iMac:~ mu234$
IS THIS OK now?


RE: PyInstaller on Mac ... does not work easily? - mu234 - Nov-20-2020

OK, now I have followed your instructions and seems ok, but when I run the final .executable in district folder I get the following:

Output:
Last login: Fri Nov 20 12:29:17 on ttys000 mkdir: /Users/mu234/.bash_sessions: Operation not permitted MU234s-iMac:~ mu234$ /Users/mu234/Desktop/Python\ delam/SM_Python/dist/SM_final/SM_final ; exit; [3054] Error loading Python lib '/Users/mu234/Desktop/Python delam/SM_Python/dist/SM_final/Python': dlopen: dlopen(/Users/mu234/Desktop/Python delam/SM_Python/dist/SM_final/Python, 10): no suitable image found. Did find: /Users/mu234/Desktop/Python delam/SM_Python/dist/SM_final/Python: code signature invalid for '/Users/mu234/Desktop/Python delam/SM_Python/dist/SM_final/Python' logout Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. [Process completed]