Cannot install Jupyter for python 2.7 due to setuptools not being the right version - python-2.7

I am developing a plugin that must be developed in Python 2.7, not Python 3, due to the application it is for requiring it. I recently upgraded to PyCharm Professional and was hoping to use the built in Jupyter support for some testing. However it says "Jupyter is not installed." I have used Jupyter Notebook for Python 2.7 before, but had to start the server from Python 3 and then launch a kernel using Python 2.7 (which was a nightmare in itself due to the accent in my name.) When trying to install Jupyter in my Python 2.7 interpreter (using "pip install jupyter"), it complains that there was "No matching distribution found for setuptools~=53.0.0". On some googling and testing, I have found that in Python 2.7 setuptools cannot be updated beyond 44.1.1.
One thing that I REALLY hope is not relevant but has been the bane of my Python 2.7 coding life so I will mention it: My user folder has an accent in it due to the fact that my name is Réka. I have done everything in my power to route things to the C:\ folder instead, but it persists in looking at things in my user folder, which sometimes causes issues.
I think it is also complaining about a package called "maturin" but I am having trouble parsing the error. If anyone would like to look, here is the full error text (with my username removed):
ERROR: Command errored out with exit status 1:
command: 'c:\python27\python.exe' 'c:\python27\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'c:\users\[user]\appdata\local\temp\pip-build-env-vf2hqh\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- maturin
cwd: None
Complete output (14 lines):
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 maturin
Using cached maturin-0.11.4.tar.gz (468 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'c:\python27\python.exe' 'c:\python27\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'c:\users\[user]\appdata\local\temp\pip-build-env-hqfzre\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools~=53.0.0' 'wheel~=0.36.2' 'toml~=0.10.2'
cwd: None
Complete output (3 lines):
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.
ERROR: Could not find a version that satisfies the requirement setuptools~=53.0.0 (from versions: 0.6b1, [cut for length, was just a list of versions], 44.1.1)
ERROR: No matching distribution found for setuptools~=53.0.0
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python27\python.exe' 'c:\python27\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'c:\users\[user]\appdata\local\temp\pip-build-env-hqfzre\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools~=53.0.0' 'wheel~=0.36.2' 'toml~=0.10.2' Check the logs for full command output.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python27\python.exe' 'c:\python27\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'c:\users\[user]\appdata\local\temp\pip-build-env-vf2hqh\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- maturin Check the logs for full command output.
I would like to know if there is an earlier version of Jupyter or something that is compatible with setuptools 44.1.1 that I could install - maybe I'm not googling the right things, but I haven't been able to find one. I can use my Python 2.7 kernel so it's not a blocking issue, but it would be very nice to be able to use Jupyter directly from PyCharm instead.

Related

How to install pip on Python 2.7 in 2021

I have legacy production servers that are still running Python 2.7.6. We have a local environment built from the docker image for ubuntu 14.04 intended to replicate that environment (things still work there once everything is installed.) The packer build script that creates this environment recently stopped working apparently due to PyPi dropping non-SNI support.
I tried using get-pip.py from the docs to download pip:
wget -c https://bootstrap.pypa.io/pip/2.7/get-pip.py
python2 get-pip.py
This gives me the following warning:
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.
/tmp/tmpBb3LJu/pip.zip/pip/_vendor/urllib3/util/ssl_.py:424: SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
/tmp/tmpBb3LJu/pip.zip/pip/_vendor/urllib3/util/ssl_.py:164: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
ERROR: Could not find a version that satisfies the requirement pip<21.0 (from versions: none)
ERROR: No matching distribution found for pip<21.0
The proposed solution for that is to use pip to upgrade urllib3
https://serverfault.com/questions/866062/easy-install-and-pip-fail-with-ssl-warnings
I don't have pip so I installed a legacy version using
apt-get install python-pip
This installs pip 1.5.4
When I try to pip install "urllib3[secure]" I get the following:
Requirement already satisfied (use --upgrade to upgrade): urllib3[secure] in /usr/lib/python2.7/dist-packages
Installing extra requirements: 'secure'
Cleaning up...
If I try pip install "urllib3[secure]" --upgrade or pip install --index-url https://pypi.python.org/simple/ --upgrade pip I get:
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement urllib3[secure] in /usr/lib/python2.7/dist-packages
Downloading/unpacking urllib3[secure]
Cleaning up...
No distributions at all found for urllib3[secure] in /usr/lib/python2.7/dist-packages
Storing debug log for failure in /root/.pip/pip.log
(the pip message reflects pip, not urllib3[secure])
When I try to use pip 1.5 to install uWSGI
pip install uWSGI
I get the following:
Downloading/unpacking uWSGI
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement uWSGI
Cleaning up...
No distributions at all found for uWSGI
Storing debug log for failure in /root/.pip/pip.log
Upgrading pip doesn't work here either
Downloading/unpacking uWSGI==2.0.18 (from -r /root/requirements.txt (line 1))
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement uWSGI==2.0.18 (from -r /root/requirements.txt (line 1))
Cleaning up...
No distributions at all found for uWSGI==2.0.18 (from -r /root/requirements.txt (line 1))
Storing debug log for failure in /root/.pip/pip.log
Reinstalling pip doesn't work:
python -m pip install -U --force-reinstall pip
Gives me:
Downloading/unpacking pip
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pip
Cleaning up...
No distributions at all found for pip
Storing debug log for failure in /root/.pip/pip.log
If I open /root/.pip/pip.log I see the following:
Downloading/unpacking pip
Getting page https://pypi.python.org/simple/pip/
Could not fetch URL https://pypi.python.org/simple/pip/: 403 Client Error: [[[!!! BREAKING CHANGE !!!]]] Support for clients that do not support Server Name Indication is temporarily disabled and will be permanently deprecated soon. See https://status.python.org/incidents/hzmjhqsdjqgb and https://github.com/pypa/pypi-support/issues/978 [[[!!! END BREAKING CHANGE !!!]]]
The link says that SNI support was dropped:
For users of Python 2.7.{0...8}
Upgrading to the last Python 2.7 release is an option.
However, note that Python 2.7 series itself is now End of Life and support in pip was dropped with version 21.0.
For users of Python 2.6.x and lower:
Neither the Python core developers, or pip maintainers support Python 2.6 and below.
If someone is aware of a work around for this issue (SNI support specifically) they are welcome to share it here for others.
There is no recommended solution from the PyPI team.
How can I get a local environment set up for new developers to work on our legacy application? I've created a new Python 3 dev server and local environment but it will be some time before I can roll out the staging and live environments, get everything moved over, and test it.
As the message says, PyPi has discontinued support for Python <2.7.9 as of May 6th 2021. If you're running a version < 2.7.9 and you cannot upgrade to a newer version of Python then your only option is to manually download the wheels from PyPi.
These are the modification I needed to make to my build script to make it work:
I needed to install software-properties-common and gcc
apt-get install -y software-properties-common gcc
Then I downloaded (setuptools](https://pypi.org/project/setuptools/44.1.1/#files) and unzipped and installed it:
python ./setuptools-44.1.1/setup.py install
Next, I downloaded pip and added it to a folder called wheels. Then I could use the whl file to run pip to get pip
python ./wheels/pip-20.3.4-py2.py3-none-any.whl/pip install --no-index --find-links ./wheels/ pip --ignore-installed
It was suggested to build a Docker container using Ubuntu 16.04 with Python 2.7.17 and use that to download the packages.
pip download -r requirements.txt
But the versions of the packages were wrong, so I ended up going through the requirements.txt and downloading each package manually from PyPi and adding it to the wheels folder. A running instance is useful so you can run pip freeze or look at a requirements.txt file to grab the version numbers of all the packages you need.
Now that I could use pip, I can install my other packages:
python pip install --no-index --find-links ./wheels/ -r /root/requirements.txt
This uncovered some dependencies that I hadn't downloaded packages for yet so I had to go through and download those and added them to the wheels folder. There were a few other things I found needed different versions than I had originally downloaded and a few packages relied on pbr and many more wanted wheel:
pip install --no-index --find-links ./wheels/ pbr==5.5.1 wheel==0.36.2
I also needed to download cMake and add it to the wheels folder
After that I could install my requirements.txt:
pip install --no-index --find-links ./wheels/ -r /root/requirements.txt --ignore-installed
May be late to the party but something similar happened to me while trying to make an HTTPS request with Python 2.7.6 (lack of SNI support). This was causing a lot of issues on a remote web server I work on.
Looking for answers I tried installing urllib3[secure] and entered a loophole since pip was complaining about a lack of SNI support to install this and other packages as well.
I found out this StackOverflow answer which helped me install the required dependencies to make Python 2.7.6 and pip itself support SNI as well as install urllib[secure].
You need to create a folder containing the required wheels (download them from PyPi using wget for instance):
pip, asn1crypto, enum34, idna, six, ipaddress, pyOpenSSL, cffi,
cryptography wheels; and also pycparser (a non-wheel, it will be a
tar.gz)
Make sure the wheels you download support Python 2.7 and that you install pip before the rest of them.
In the original answer, its stated you can use python -m OpenSSL.debug to verify everything worked correctly (a ModuleNotFoundError would mean the pyOpenSSL package was not installed). You can also use pip -Vto check that the new pip version was installed correctly as well.
After updating pip and installing these dependencies I was able to install urllib3[secure] and get SNI support from python as well as pip.
Good luck!
I am sharing this answer as an update to Jonathan Rys's answer that contains the steps required as of the date of this answer. I tried to keep this concise.
As the message says, PyPi has discontinued support for Python <2.7.9 as of May 6th 2021. If you're running a version < 2.7.9 and you cannot upgrade to a newer version of Python then your only option is to manually download the wheels from PyPi.
For Ubuntu 20.04, I have installed build-essential sudo apt-get install build-essential
I installed Python 2 from source, downloading tar bundle and built and installed this. Note, I removed the python command, to avoid that old confusion, so we have python2 and python2.7 and also python3 (for example).
tar xf Python-2.7.18.tgz
cd Python-2.7.18
./configure && make && sudo make install
(cd /usr/local/bin;sudo rm python python-config)
cd ..
Now to get pip installed. Download setuptools zip archive. Then install it:
unzip setuptools-44.1.1.zip
cd setuptools-44.1.1
python2 bootstrap.py
sudo python2 setup.py install
cd ..
Next, I downloaded pip .tar.gz archive. Then unpack and install it. Note, I took extra steps to preserve and restore the original python3 pip in /usr/local/bin. Pip for Python2 are still available as pip2 and pip2.7 in the same directory.
tar xf pip-20.3.4.tar.gz
cd pip-20.3.4
(cd /usr/local/bin;sudo mv pip pip-save)
sudo python2 setup.py install
(cd /usr/local/bin;sudo mv pip-save pip)
Now that I could use pip, I can install the most important package any Python user should install, ipython. Note that I do a user install for this and also preserve my "ipython" command to run python3 and have ipython2 to run python2:
pip2.7 install ipython
(cd ~/.local/bin;rm ipython;ln -s ipython3 ipython)
and it works!
$ ipython2
Python 2.7.18 (default, Jun 22 2022, 09:38:45)
Type "copyright", "credits" or "license" for more information.
IPython 5.10.0 -- An enhanced Interactive Python.

On Plone 4.3.15, how to install latest Stripe's API

On Plone 4.3.15 (Universal installation), it is not possible to install stripe 2.32.1.
See logs :
Getting distribution for 'stripe==2.32.1'.
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'
warnings.warn(msg)
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
error: Setup script exited with error in stripe setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers
An error occurred when trying to install stripe 2.32.1. Look above this message for any errors that were output by easy_install.
While:
Installing instance.
Getting distribution for 'stripe==2.32.1'.
Error: Couldn't install: stripe 2.32.1
It seems that easy_install / Setuptools is too old ?
Do I need to upgrade Setuptool ? If so, how can it be done ?
'install_requires' must be a string or list of strings containing valid project/version requirement specifiers
Yes, your setuptools is too old. To upgrade:
pip install -U setuptools
Perhaps you also need to upgrade pip:
pip install -U pip setuptools

Command "python setup.py egg_info" failed with error code 1 in PATH/psycopg2

I needed to upgrade PostgreSQL from version 9.5 to version 11. After that, when I recreated my virtualEnv from a 'requirements.txt' file, I started giving the following error when installing the psycopg2 package:
Collecting psycopg2 == 2.6.2 (from -r conf/requirements.txt (line 50))
  Using cached https://files.pythonhosted.org/packages/7b/a8/dc2d50a6f37c157459cd18bab381c8e6134b9381b50fbe969997b2ae7dbc/psycopg2-2.6.2.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/psycopg2.egg-info
    writing pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
    Error: could not determine PostgreSQL version from '11 .1 '
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-0Q7bhV/psycopg2/
After some research, I ran the following commands to try to solve, but it did not work:
sudo apt-get install postgresql-server-dev-all
sudo apt-get install postgresql-common
Finally, I noticed that version 2.6.2 of psycopg2 only supports version 9.5 of postgresql. For 11 you should use the latest version of psycopg2, that is, version 2.7.7. After you change the requirements.txt file, and the virtualEnv has been recreated correctly.
I hope it will be useful to others.
Go for this Command Python3 - sudo apt install libpq-dev python3-dev

python pip install error language_check

When I am trying to install sudo pip install language_check
I got this error:
Collecting language_check
Downloading language-check-1.0.tar.gz
Complete output from command python setup.py egg_info: zip_safe flag not set; analyzing archive contents...
Installed /tmp/pip-build-_cYgOq/language-check/.eggs/3to2-1.1.1-py2.7.‌​
egg error in language-check setup command: package_data must be a dictionary
mapping package names to lists of wildcard patterns
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-_cYgOq/language-check/
It's a bug in language-check. They fixed it at 23 March but didn't include in any release yet (release 1.0 was from 21 March).
Download the sources from Github and install with
python setup.py install
I believe that if you install the latest version of Python, python3.6.2 it should work.
git clone -b patch-1 https://github.com/SpartorA/language-check.git
python setup.py install
Above will work
I was able to successfully install language-check in my Python 3.7 environment on MacOS as follows:
Check Java installation :
for language-check, Java 8 is expected
For MacOS: Follow these steps : https://stackoverflow.com/a/24657630
Install language-check
pip install language-check, won't directly work, you would have to:
Install from a forked & fixed repo for language-check
pip install git+https://github.com/MCFreddie777/language-check.git

Vagrant 'paver devstack lms' Starting server: Command "python setup.py egg_info" failed with error code 1

I'm trying to install a devstack edx and I'm having some problems. I found this post
How to fix python requirements update error (master branch) - SSO feature merged
But didn't work for me.
When I try to start the server I get the next fail:
dxapp#precise64:~/edx-platform$ paver devstack studio
---> pavelib.servers.devstack
---> pavelib.prereqs.install_prereqs
---> pavelib.prereqs.install_ruby_prereqs
Ruby prereqs unchanged, skipping...
---> pavelib.prereqs.install_node_prereqs
Node prereqs unchanged, skipping...
---> pavelib.prereqs.install_python_prereqs
pip install -q --exists-action w -r requirements/edx/pre.txt
You are using pip version 6.0.8, however version 7.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
pip install -q --exists-action w -r requirements/edx/github.txt
You are using pip version 6.0.8, however version 7.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Could not find a tag or branch '96e1922348bfe6d99201b9512a9ed946c87b7e0b', assuming commit.
Could not find a tag or branch 'b0686a76f1ce3532088c4aee6e76b9abe61cc808', assuming commit.
Could not find a tag or branch 'd89aae2a82f2b', assuming commit.
[... more lines with the same content ....]
Could not find a tag or branch 'a286e89c73e1b788e35ac5b08a54b71a9fa63cfd', assuming commit.
Could not find a tag or branch '64a8b603f42669bb7fdca03d364d4e8d3d6ad67d', assuming commit.
Could not find a tag or branch '172a90fd2738f8142c10478356b2d9ed3e55334a', assuming commit.
pip install -q --exists-action w -r requirements/edx/local.txt
You are using pip version 6.0.8, however version 7.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
pip install -q --exists-action w -r requirements/edx/base.txt
You are using pip version 6.0.8, however version 7.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
meliae is potentially insecure and unverifiable.
Requested meliae==0.4.0 (from -r requirements/edx/base.txt (line 53)), but installing version None
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-rNPjSe/dm.xmlsec.binding`<br>
Captured Task Output:
---------------------
---> pavelib.servers.devstack
---> pavelib.prereqs.install_prereqs
---> pavelib.prereqs.install_ruby_prereqs
---> pavelib.prereqs.install_node_prereqs
---> pavelib.prereqs.install_python_prereqs
pip install -q --exists-action w -r requirements/edx/pre.txt
pip install -q --exists-action w -r requirements/edx/github.txt
pip install -q --exists-action w -r requirements/edx/local.txt
pip install -q --exists-action w -r requirements/edx/base.txt
Build failed running pavelib.servers.devstack: Subprocess return code:1
By the way, I've already try to update pip, it looks like everything is ok (Successfully installed pip-7.1.0), but I always get that message when try the paver devstack studio.
Solve this problem with some steps:
Requested meliae==0.4.0 (from -r requirements/edx/base.txt (line 53)),but installing version None
This line define there is some error in base.txt file when vagrant try to install all base.txt file dependences.
Solve this in steps:
1) Open base.txt file and comment meliae==0.4.0 line like (#meliae==0.4.0)
2) Now try pip install -r base.txt file if it successfully run then no problem or if any other package create problem then follow 1(comment this for now) step.
3) after successfully run base.txt
3.1) exit from edx-platform
3.2) On vagrant instance (comes after vagrant ssh command) install all commented packages (pip install meliae==0.4.0 in my case)
NOW run your lms system again :)
if the above steps don't work, try installing Cython, meliae==0.4.0, and libxmlsec1 from Vagrant instance.