Problems installing pyinstaller - python

I tried pip install and received this:
Requirement already satisfied: pyinstaller in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (4.5.1)
Requirement already satisfied: altgraph in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (0.17)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (2021.2)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied: pefile>=2017.8.1 in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (2021.5.24)
Requirement already satisfied: setuptools in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pyinstaller) (49.2.1)
Requirement already satisfied: future in c:\users\sinwe\appdata\local\programs\python\python39\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.18.2)
I then installed using setup.py
To check whether it is installed, in cmd:
pyinstaller --version
and I received this:
Traceback (most recent call last):
File "C:\Users\sinwe\AppData\Local\Programs\Python\Python39\Scripts\pyinstaller-script.py", line 33, in <module>
sys.exit(load_entry_point('pyinstaller==4.5.1', 'console_scripts', 'pyinstaller')())
File "C:\Users\sinwe\AppData\Local\Programs\Python\Python39\Scripts\pyinstaller-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
StopIteration
Could anyone provide a solution?

Try to uninstall pyinstaller using:
pip uninstall pyinstaller
in the cmd, and upgrade pip:
pip install --upgrade pip
And then try to install pyinstaller again:
pip install pyinstaller

Related

I have installed IPython, and still "No module named 'IPython'"

My Python version:Python 3.8.3
python -m pip install IPython gives me Successfully installed IPython-7.18.1
Still gives me the following error:
from IPython.display import Image
/usr/bin/python3 "/home/sanyifeju/Desktop/python/ML/decision_trees.py"
Traceback (most recent call last):
File "/home/sanyifeju/Desktop/python/ML/decision_trees.py", line 4, in <module>
from IPython.display import Image
ModuleNotFoundError: No module named 'IPython'
'
What am I missing?
I am on Ubuntu 20.04.1 , not sure if that makes any difference.
if I run python -m pip install ipython
I get Requirement already satisfied.
Requirement already satisfied: ipython in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (7.18.1)
Requirement already satisfied: setuptools>=18.5 in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from ipython) (49.6.0.post20200814)
Requirement already satisfied: decorator in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from ipython) (4.4.2)
Requirement already satisfied: pexpect>4.3; sys_platform != "win32" in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from ipython) (4.8.0)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from ipython) (3.0.7)
Requirement already satisfied: jedi>=0.10 in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from ipython) (0.17.1)
Requirement already satisfied: pygments in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from ipython) (2.7.1)
Requirement already satisfied: backcall in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from ipython) (0.2.0)
Requirement already satisfied: pickleshare in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from ipython) (0.7.5)
Requirement already satisfied: traitlets>=4.2 in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from ipython) (4.3.3)
Requirement already satisfied: ptyprocess>=0.5 in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from pexpect>4.3; sys_platform != "win32"->ipython) (0.6.0)
Requirement already satisfied: wcwidth in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython) (0.2.5)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from jedi>=0.10->ipython) (0.7.0)
Requirement already satisfied: ipython-genutils in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from traitlets>=4.2->ipython) (0.2.0)
Requirement already satisfied: six in /home/sanyifeju/anaconda3/lib/python3.8/site-packages (from traitlets>=4.2->ipython) (1.15.0)
I had the same issue, and the problem was that the python command was linked to the python2 version:
$ ls -l /usr/bin/python
lrwxrwxrwx 1 root root 7 Apr 15 2020 /usr/bin/python -> python2*
The following commands fixed it for me:
$ sudo rm /usr/bin/python
$ sudo ln -s python3 /usr/bin/python
Try installing-
python -m pip install ipython

Failed to import 'keystoneauth1' ... albeit installed?

I am using python3 via brew on MacOs.
When I do
> python3 -c "import keystoneauth1"
I get:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'keystoneauth1'
But then:
> pip3 install keystoneauth1
Requirement already satisfied: keystoneauth1 in /usr/local/lib/python3.7/site-packages (3.9.0)
Requirement already satisfied: iso8601>=0.1.11 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (0.1.12)
Requirement already satisfied: os-service-types>=1.2.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (1.2.0)
Requirement already satisfied: stevedore>=1.20.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (1.28.0)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (4.1.0)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (1.11.0)
Requirement already satisfied: requests>=2.14.2 in /usr/local/lib/python3.7/site-packages (from keystoneauth1) (2.19.1)
Requirement already satisfied: idna<2.8,>=2.5 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (2.7)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (2018.4.16)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (1.23)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.7/site-packages (from requests>=2.14.2->keystoneauth1) (3.0.4)
Nothing else shows up there. When I then verify the installation, things look good:
> pip3 show keystoneauth1
Name: keystoneauth1
Version: 3.9.0
Summary: Authentication Library for OpenStack Identity
Home-page: https://docs.openstack.org/keystoneauth/latest/
Author: OpenStack
Author-email: openstack-dev#lists.openstack.org
License: UNKNOWN
Location: /usr/local/lib/python3.7/site-packages
Requires: stevedore, requests, pbr, os-service-types, six, iso8601
Required-by: openstacksdk, keystoneauth
But as shown, already importing that module doesn't work.
For me, the problem manifested itself after upgrading brew python to the lastest version 3.7.6.
I explicitly upgraded brew, and pip3 as well, but no luck.
And sorry for the repeated typos. The module name is really keystoneauth1.
I really don't understand what exactly is going on here.
So this isn't really an answer that explains and solves the issue, but the workaround that worked for me:
First, I force removed python brew uninstall --ignore-dependencies python
Then, I only installed it again brew install python
And afterwards, my scripts (that in the end used that import) work again without any problems?!

Installing PyInstaller on Mac

I have not seen this issue in my google searches. I am trying to install PyInstaller on my work Mac which I do not have administrative access.
$ pip install --user pyinstaller
Collecting pyinstaller
Requirement already satisfied: dis3 in ./Library/Python/2.7/lib/python/site-packages (from pyinstaller)
Requirement already satisfied: setuptools in ./Library/Python/2.7/lib/python/site-packages (from pyinstaller)
Requirement already satisfied: macholib>=1.8 in ./Library/Python/2.7/lib/python/site-packages (from pyinstaller)
Requirement already satisfied: pefile>=2017.8.1 in ./Library/Python/2.7/lib/python/site-packages (from pyinstaller)
Requirement already satisfied: altgraph>=0.15 in ./Library/Python/2.7/lib/python/site-packages (from macholib>=1.8->pyinstaller)
Requirement already satisfied: future in ./Library/Python/2.7/lib/python/site-packages (from pefile>=2017.8.1->pyinstaller)
Installing collected packages: pyinstaller
Successfully installed pyinstaller-3.3.1
The install seems successful, however...
$ pyinstaller
-bash: pyinstaller: command not found
I checked my PATH
$ echo $PATH
/usr/local/git/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/jc/Library/Python/2.7/lib/python/site-packages
What am I missing here?
Thanks for reading.
I had to install the tar.gz file from here:
http://www.pyinstaller.org/downloads.html
Then it can be run from the extracted folder.
$ python pyinstaller.py script.py
On my Mac pip installed the binary in /Users/%Username%/Library/Python/2.7/bin. If you add that to your PATH it should work.

import boto3 error on Mac OS

I'm trying to install boto3 on my mac (high sierra 10.13.3) and tried to follow : https://github.com/boto/boto3. I had already installed python 3 using homebrew before, but when I tried to see pip --version, I get error.
So, I did
1) modify .bash_profile to add
alias pip=pip3
2) verify
$ pip --version
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
3)
$ pip install boto3
Collecting boto3
Downloading boto3-1.5.36-py2.py3-none-any.whl (128kB)
100% |████████████████████████████████| 133kB 474kB/s
Collecting botocore<1.9.0,>=1.8.50 (from boto3)
Downloading botocore-1.8.50-py2.py3-none-any.whl (4.1MB)
100% |████████████████████████████████| 4.1MB 376kB/s
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in ./Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in ./Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in ./Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: docutils>=0.10 in ./Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: six>=1.5 in ./Library/Python/3.6/lib/python/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.9.0,>=1.8.50->boto3)
Installing collected packages: botocore, boto3
Found existing installation: botocore 1.8.20
Uninstalling botocore-1.8.20:
Successfully uninstalled botocore-1.8.20
Successfully installed boto3-1.5.36 botocore-1.8.50
4) just to make sure this was fine, I ran
$ pip3 install boto3
Requirement already satisfied: boto3 in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: botocore<1.9.0,>=1.8.50 in /usr/local/lib/python3.6/site-packages (from boto3)
Requirement already satisfied: docutils>=0.10 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: six>=1.5 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.9.0,>=1.8.50->boto3)
5) but, now when I ran import boto3 in Idle, I get error
import boto3
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import boto3
ModuleNotFoundError: No module named 'boto3'
I even tried to change path in .bash_profile, but it did not work.
Thoughts?
It worked for me to just copy all of packages with "bolo" in the name from the Python 3.7 folder to the Python 2.7 folder:
/usr/local/lib/python3.7/site-packages $ sudo cp -R boto* /Library/Python/2.7/site-packages/.

How to maintain same permissions on python dist-package after upgrade?

I am using a python package patroni version 1.0 on Ubuntu 14. On doing ls -lrt /usr/local/lib/python2.7/dist-packages/ I am seeing the permission like below
But once I upgrade the patroni via the command sudo pip install patroni --upgrade I am seeing the permission of the patroni changes after upgrade
The installation output is -
sudo pip install patroni --upgrade
The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting patroni
Requirement already up-to-date: requests in /usr/local/lib/python2.7/dist-packages (from patroni)
Collecting cdiff (from patroni)
Requirement already up-to-date: six>=1.7 in /usr/local/lib/python2.7/dist-packages (from patroni)
Collecting python-etcd<0.5,>=0.4.3 (from patroni)
Requirement already up-to-date: prettytable>=0.7 in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: tzlocal in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: boto in /usr/local/lib/python2.7/dist-packages (from patroni)
Collecting python-consul>=0.7.0 (from patroni)
Downloading python_consul-0.7.2-py2.py3-none-any.whl
Requirement already up-to-date: psycopg2>=2.6.1 in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: kazoo==2.2.1 in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: urllib3>=1.9 in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: click>=4.1 in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: python-dateutil in /usr/local/lib/python2.7/dist-packages (from patroni)
Collecting psutil (from patroni)
Requirement already up-to-date: PyYAML in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: certifi>=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests->patroni)
Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/dist-packages (from requests->patroni)
Requirement already up-to-date: idna<2.7,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests->patroni)
Requirement already up-to-date: dnspython>=1.13.0 in /usr/local/lib/python2.7/dist-packages (from python-etcd<0.5,>=0.4.3->patroni)
Requirement already up-to-date: pytz in /usr/local/lib/python2.7/dist-packages (from tzlocal->patroni)
Installing collected packages: cdiff, python-etcd, python-consul, psutil, patroni
Found existing installation: python-etcd 0.4.3
Uninstalling python-etcd-0.4.3:
Successfully uninstalled python-etcd-0.4.3
Found existing installation: python-consul 0.6.0
Uninstalling python-consul-0.6.0:
Successfully uninstalled python-consul-0.6.0
Found existing installation: patroni 1.0
Uninstalling patroni-1.0:
Successfully uninstalled patroni-1.0
Successfully installed cdiff-1.0 patroni-1.3.6 psutil-5.4.1 python-consul-0.7.2 python-etcd-0.4.5
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I had to use sudo if I do just pip install patroni --upgrade then it is failing with the below error:-
pip install patroni --upgrade
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting patroni
Downloading patroni-1.3.6.tar.gz (90kB)
100% |████████████████████████████████| 94kB 1.0MB/s
Requirement already up-to-date: urllib3>=1.9 in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: boto in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: psycopg2>=2.6.1 in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: PyYAML in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: requests in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: six>=1.7 in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: kazoo==2.2.1 in /usr/local/lib/python2.7/dist-packages (from patroni)
Collecting python-etcd<0.5,>=0.4.3 (from patroni)
Downloading python-etcd-0.4.5.tar.gz
Collecting python-consul>=0.7.0 (from patroni)
Downloading python_consul-0.7.2-py2.py3-none-any.whl
Requirement already up-to-date: click>=4.1 in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: prettytable>=0.7 in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: tzlocal in /usr/local/lib/python2.7/dist-packages (from patroni)
Requirement already up-to-date: python-dateutil in /usr/local/lib/python2.7/dist-packages (from patroni)
Collecting psutil (from patroni)
Downloading psutil-5.4.1.tar.gz (408kB)
100% |████████████████████████████████| 409kB 1.1MB/s
Collecting cdiff (from patroni)
Downloading cdiff-1.0.tar.gz
Requirement already up-to-date: certifi>=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests->patroni)
Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/dist-packages (from requests->patroni)
Requirement already up-to-date: idna<2.7,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests->patroni)
Requirement already up-to-date: dnspython>=1.13.0 in /usr/local/lib/python2.7/dist-packages (from python-etcd<0.5,>=0.4.3->patroni)
Requirement already up-to-date: pytz in /usr/local/lib/python2.7/dist-packages (from tzlocal->patroni)
Building wheels for collected packages: patroni, python-etcd, psutil, cdiff
Running setup.py bdist_wheel for patroni
Stored in directory: /home/ubuntu/.cache/pip/wheels/86/5a/e3/cb4ac4ecf20bc7a2956062d3c3ad15c660a993a0cc3aa23d35
Running setup.py bdist_wheel for python-etcd
Stored in directory: /home/ubuntu/.cache/pip/wheels/d1/79/df/26facc508cdb5fefaf3d574fb634d848754a7e69d95f53f056
Running setup.py bdist_wheel for psutil
Stored in directory: /home/ubuntu/.cache/pip/wheels/05/a2/2a/2015d6af91fb5a4cc5bcdfa9699034e2f624fc9cc5acde7ab9
Running setup.py bdist_wheel for cdiff
Stored in directory: /home/ubuntu/.cache/pip/wheels/d9/67/dc/d53a3cfea638a5652d0d2054b447d67a7d2a2bdebf0f67765e
Successfully built patroni python-etcd psutil cdiff
Installing collected packages: python-etcd, python-consul, psutil, cdiff, patroni
Found existing installation: python-etcd 0.4.3
Uninstalling python-etcd-0.4.3:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 311, in run
root=options.root_path,
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 716, in uninstall
paths_to_remove.remove(auto_confirm)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_uninstall.py", line 125, in remove
renames(path, new_path)
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 315, in renames
shutil.move(old, new)
File "/usr/lib/python2.7/shutil.py", line 303, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/etcd/__init__.py'
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Can someone let me know
Why is the permission changing after upgrade?
How can I have the same permission even after the upgrade?
I'm sure the problem is in sudo. sudo runs a new shell under root user and the new shell reads configuration files from /root/ directory. It seems /root/.bash_profile has a command umask 027 in it. Change it to 022 and the problem should be fixed.

Categories

Resources