Can't install pyinstaller on python 2 - python

pip2 install pyinstaller
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting pyinstaller
Using cached pyinstaller-4.1.tar.gz (3.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python2 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpXfz8sO
cwd: /tmp/pip-install-VoIwF7/pyinstaller
Complete output (4 lines):
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 16, in <module>
from importlib import import_module
ImportError: No module named importlib
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python2 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpXfz8sO Check the logs for full command output.
on both windows and linux unable to install pyinstaller on python 2. Say similar error. I need to compile a code written on python 2. Any body occur same error? Please help

The latest version of pyinstaller does not support Python 2.7, as described under Requirements.
For Python 2.7 to work, you must install version 3.6.

First of all, you should upgrade your python version and here you are importing the package that is not installed so install first using pip install importlib

Related

My Kali linux showing 'No module named importlib' 'from importlib import import_module'

Trying to install build dependencies with pip which is installing in /usr/local/lib/python2.7/dist-packages
As I try to install proceed gives an error
Collecting git+https://github.com/kti/python-netfilterqueue (from -r requirements.txt (line 1))
Cloning https://github.com/kti/python-netfilterqueue to /tmp/pip-req-build-VQbxfT
Running command git clone -q https://github.com/kti/python-netfilterqueue /tmp/pip-req-build-VQbxfT
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python2 /usr/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpNlNAvr
cwd: /tmp/pip-req-build-VQbxfT
Complete output (4 lines):
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 16, in <module>
from importlib import import_module
ImportError: No module named importlib
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python2 /usr/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpNlNAvr Check the logs for full command output.
so I try to install importlib with pip and I still get the same error. Then I install it directly to /usr/lib/python2.7/dist-packages/pip/_vendor/pep517/ using
pip install importlib --target=/usr/lib/python2.7/dist-packages/pip/_vendor/pep517/
because pip has been installing all packages to /usr/local/lib/python2.7/dist-packages,
but I still get the error either way
Assuming you are trying to install python-netfilterqueue.
You can visit github page and see this
The current version of NetfilterQueue requires Python 3.6 or later.
So you can't install this lib for python 2.7
But you can install 0.9.0 as it also stated that
The last version with support for Python 2.7 was 0.9.0.
pip install NetfilterQueue=0.9.0
Try switching to python3 because this will definitely work.
First you have to install cython.
pip install cython
Then after that you need to make sure you install NetfilterQueue from source.
git clone https://github.com/oremanj/python-netfilterqueue
Navigate to the netfilterqueue directory.
cd python-netfilterqueue
Then run this command.
python3 setup.py install
That's it. It should work properly

Issue with Installing Pillow for Python

I am trying to install Pillow in my RedHat operating system through pip
sudo pip install Pillow
However, I receive the following error
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting Pillow
/usr/lib/python2.6/sitepackages/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
Downloading Pillow-4.2.1.tar.gz (12.7MB)
100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 12.7MB 35kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-5XOfq_/Pillow/setup.py", line 143
required = {'jpeg', 'zlib'}
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5XOfq_/Pillow
How can I address this?
Thanks
The error you're getting has to do with the new syntax for creating sets that was introduced in Python 2.7.
{item1, item2, ...}
It seems you're running a version of Python prior to 2.7, which doesn't recognize this as valid syntax.
Pillow's web site includes notes on which versions of Pillow are compatible with which versions of Python. You'll need to either upgrade Python (recommended), or choose an older version of Pillow which works with the Python version you have.
http://prodiguer.github.io/synda/faq.html#transfer-module
here says:
This bug affects 3.6 version installed from source (RPM 3.6 and DEB
3.6 should not be affected). It has been fixed in 3.7. It can be fixed in 3.6 by downgrading the pypi pillow package:
pip install pillow==3.4.2

Error installing pydns

While trying to install pydns module i am getting this error:
C:\Windows\system32>pip install pydns
Collecting pydns
Using cached pydns-2.3.6.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Shiva\AppData\Local\Temp\pip-build-294324_x\pydns\setup.py", line 12, in <module>
import DNS
File "C:\Users\Shiva\AppData\Local\Temp\pip-build-294324_x\pydns\DNS\__init__.py", line 14, in <module>
import Type,Opcode,Status,Class
ImportError: No module named 'Type'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Shiva\AppData\Local\Temp\pip-build-294324_x\pydns\
I tried pip install py3dns as well but it doesn't work.
You are using the wrong version of python. pydns is not supported for python 3. pydns works for python2.7
For python3 use pip3 install py3DNS
The pydns is not supported with Python 3. You need to use python 2.7 to work with it.
It seem that there is a conflict between pyDNS and dnspython built-in package :
** / ! \ To run this solution for python3 please replace pyDNS by py3DNS**
Step 1 remove dnspython :
$ pip uninstall dnspython
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Found existing installation: dnspython 1.15.0
Uninstalling dnspython-1.15.0:
Would remove:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/*
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dnspython-1.15.0.dist-info/*
Would not remove (might be manually added):
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Base.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Base.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Class.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Class.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Lib.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Lib.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Opcode.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Opcode.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Status.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Status.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Type.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Type.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/lazy.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/lazy.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/win32dns.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/win32dns.pyo
Proceed (y/n)? y
Successfully uninstalled dnspython-1.15.0
Step 2 remove pyDNS :
$ pip uninstall pydns
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Found existing installation: pydns 2.3.6
Uninstalling pydns-2.3.6:
Would remove:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Base.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Base.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Class.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Class.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Lib.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Lib.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Status.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Status.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Type.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Type.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/lazy.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/lazy.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/win32dns.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/win32dns.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydns-2.3.6.dist-info/*
Proceed (y/n)? y
Successfully uninstalled pydns-2.3.6`
### Step 2 Install pyDNS again :
`$ pip install pydns
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Processing /Library/Caches/pip/wheels/54/c3/70/622b2f4958520225fab47eceb1e2659ac4d03ec6760ec26024/pydns-2.3.6-py2-none-any.whl
Installing collected packages: pydns
Successfully installed pydns-2.3.6
Step 3 Check the installed package with :
$ python -m DNS
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named DNS.__main__; 'DNS' is a package and cannot be directly executed
Enjoy

Syntax error when installing csc-pysparse

I am new to Python and I am trying to install recsys package.
http://ocelma.net/software/python-recsys/build/html/installation.html
For this i need to install some pre-requiste packages, so i have to run this using pip
pip install csc-pysparse networkx divisi2
But whenever i run this i get the following in logs
Collecting csc-pysparse
Using cached csc-pysparse-1.1.1.4.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\64\AppData\Local\Temp\pip-build-wn7_65_9\csc-pysparse\
setup.py", line 33
print 'setuptools module not found.'
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\i054564\
AppData\Local\Temp\pip-build-wn7_65_9\csc-pysparse\
I checked that setuptools exist in my python installation here
C:\Python34\lib\site-packages
I have ran everything from unstinalling setuptools to install it again, upgrade command, but it does not work.
Not able to figure out why setuptools is not found. Is it not found in the path of where pip resolves it from ?
cheers,
Saurav
The code triggering the error is Python 2-specific and is illegal in Python 3.
Apparently, csc-pysparse doesn't support Python 3 (its README only mentions 2.6) and looks abandoned (6 years since last commit).
Some guys out there suggest replacing it with SciPy.
The error is coming from the installation code of recsys package. In order to avoid this error, you need to install setuptools separately.
For debian machines, the below command will work.
sudo apt-get install python3-setuptools
For other machines, please checkout installation instructions at the link
Once setuptools package is installed, you can proceed with csc-pysparse installation.

"AssertionError: Only python 2.7 and later is supported by ptyprocess", when installing pexpect via pip on python 2.6

I got following error when trying install pexpect via pip:
# pip install pexpect
Collecting pexpect
do_ypcall: clnt_call: RPC: Unable to receive; errno = Connection refused
/usr/lib/python2.6/site-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
Using cached pexpect-4.0.tar.gz
Collecting ptyprocess>=0.5 (from pexpect)
Using cached ptyprocess-0.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-2X4It7/ptyprocess/setup.py", line 10, in <module>
"Only python 2.7 and later is supported by ptyprocess.")
AssertionError: Only python 2.7 and later is supported by ptyprocess.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-2X4It7/ptyprocess
It's pretty clear that downloaded ptyprocess works only with python 2.7, but doesn't pip should download correct packages versions, that are compatible with installed python versions?
My system info:
pip -V: pip 7.1.2 from /usr/lib/python2.6/site-packages (python 2.6)
python -V: Python 2.6.6
OS: CentOS 6.3
BTW: yum install pexpect succesfully installs pexpect package
Thank You
yum will install pexpect v2.3.6.
easy_install or pip will install pexpect v4.0.1 as of today.
You can use pexpect version 3.3 which not depends on ptyprocess version.
# easy_install pexpect==3.3
or
# pip install pexpect==3.3
AssertionError: Only python 2.7 and later is supported by ptyprocess.
pyexpect depends on ptyprocess>=0.5 (https://github.com/pexpect/pexpect/blob/master/setup.py#L66)
You will need to install a version of ptyprocess that is >=0.5 but works with python 2.6 first, then install pyexpect.
edit looks like you are out of luck, 0.5 requires python 2.7 (https://github.com/pexpect/ptyprocess/blob/master/setup.py#L9-L10). Your system package has it patched to work with 2.6 so you'll have to use that.

Categories