Python3.2 - ImportError: No module named setuptools - python-3.x

When I run "sudo python3.2 setup.py install" I repeatedly get the error below
Traceback (most recent call last):
File "setup.py", line 3, in module
from setuptools import setup
ImportError: No module named setuptools
I've installed setuptools using apt-get, removed it & then manually installed by doing the following:
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.x.tar.gz
tar zxvf setuptools-0.x.tar.gz
cd setuptools-0.x
python setup.py build
python setup.py install
I can't figure out why I'm still getting the error after repeated installations?

Related

Why does pyarrow installation fail with cython not found when cython is included in requirements.txt?

So, I have a docker file in which one of the instructions is :
RUN pip3 install -r requirements.txt
And in my requirements.txt:
...
uwsgi==2.0.19.1
cython==0.29
dependency-injector==4.37.0
pyyaml==6.0
apscheduler==3.7.0
pyarrow==5.0.0
...
When I run the docker build, I see that Cython is installed but pyarrow still fails. I found this link - https://github.com/apache/arrow/issues/2163 - which mentions that cmake & cython are required and I added that in my requirements.txt but it still does not help. Do I have to add additional statements in my Dockerfile to install cython?
Output from Dockerfile build:
Collecting cython==0.29 (from -r requirements.txt (line 8))
Downloading https://files.pythonhosted.org/packages/64/3f/cac281f3f019b825bbc03fa8cb7eb03d9c355f4aa9eef978279a4966cb21/Cython-0.29-cp36-cp36m-manylinux1_x86_64.whl (2.1MB)
...
Collecting pyarrow==5.0.0 (from -r requirements.txt (line 12))
Downloading https://files.pythonhosted.org/packages/68/7c/0e38bfb949ededdd9b648d54cba47972835704543d7409d6f853504d0581/pyarrow-5.0.0.tar.gz (739kB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-395casa1/pyarrow/setup.py", line 39, in <module>
from Cython.Distutils import build_ext as _build_ext
ModuleNotFoundError: No module named 'Cython'
Python 3.6 installed on this base image
Ugh, this is probably one of my dumb-dumb moments but here's what worked:
RUN pip3 install --upgrade pip && pip install -r requirements.txt
and I didn't even have to specify cython in requirements.txt

Error in pdfminer library installation in conda environment

I installed "pdfminer" in virtual environment of conda.
I installed and reinstalled the library with following commands :
conda install -c conda-forge pdfminer
conda install -c conda-forge/label/cf201901 pdfminer
conda install -c conda-forge/label/cf202003 pdfminer
I got the same error all the time. It was like this:
/home/hamza/anaconda3/envs/my/bin/python /home/hamza/PycharmProjects/practice/pdf_info.py
20191125
Traceback (most recent call last):
File "/home/hamza/PycharmProjects/practice/pdf_info.py", line 67, in <module>
from pdfminer.high_level import extract_text
File "/home/hamza/anaconda3/envs/my/lib/python3.7/site-packages/pdfminer/high_level.py", line 14, in <module>
from .utils import open_filename
ImportError: cannot import name 'open_filename' from 'pdfminer.utils' (/home/hamza/anaconda3/envs/my/lib/python3.7/site-packages/pdfminer/utils.py)
Process finished with exit code 1
Is there any alternate way to install this library or what we can do this resolve this error

ModuleNotFoundError: No module named 'pip._internal.cli.main'

Hey Guys i just want to share this with you in case you get the same error :
pip3 -V
Traceback (most recent call last):
File "/Users/$(whoami)/Library/Python/3.7/bin/pip3", line 5, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal.cli.main'
I've just solved this problem by updating pip. Like this:
python -m pip install --upgrade pip --user
Solution :
remove all python folders, and reference found here :
/usr/local/bin/
/usr/local/lib
/usr/local/Cellar/
/Users/$(whoami)/Library/Python/
/Library/Frameworks/Python.framework/Versions/ (Only if it exists !! for me it doesnt)
Then run :
brew install python3

Installing egg through pip

I can successfully install egg for morfeusz2 through
python -m easy_install http://sgjp.pl/morfeusz/download/20181014/ubuntu-xenial/morfeusz2-0.4.0-py3.7-win-amd64.egg
However, all other dependencies I define through requirements.txt. I would like all of them to be defined in a consistent way. morfeusz2 is not present in any PyPI repo. How can I define dependencies for my project in a consistent way?
For instance, I have tried to define the following requirements.txt file:
django
pint
http://sgjp.pl/morfeusz/download/20181014/ubuntu-xenial/morfeusz2-0.4.0-py3.7-win-amd64.egg
However, when running pip install -r requirements.txt it fails with:
(mealplanner) D:\Projects-intellij\djangoproject\mealplanner>pip install -r requirementx.txt
Collecting http://sgjp.pl/morfeusz/download/20181014/ubuntu-xenial/morfeusz2-0.4.0-py3.7-win-amd64.egg (from -r requirementx.txt (line 3))
Downloading http://sgjp.pl/morfeusz/download/20181014/ubuntu-xenial/morfeusz2-0.4.0-py3.7-win-amd64.egg (7.7MB)
100% |████████████████████████████████| 7.7MB 11.4MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\oem\virtualenv\mealplanner\lib\tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\OEM\\AppData\\Local\\Temp\\pip-req-build-xucfpk6m\\setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\OEM\AppData\Local\Temp\pip-req-build-xucfpk6m\
How do I install egg with pip install?

Creating new virtualenv with python3.4

I'm getting the following error when trying to set up a new virtualenv with python3.4 (I'm running this command: virtualenv –p /usr/bin/python /tmp/djangodev):
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site- packages/pkg_resources.py", line 2697, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pkg_resources.py", line 669, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pkg_resources.py", line 576, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (virtualenv 1.11.6 (/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages),
Requirement.parse('virtualenv==1.7.2'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pkg_resources.py", line 2701, in <module>
parse_requirements(__requires__), Environment()
File "/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pkg_resources.py", line 572, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: virtualenv==1.7.2
I first downloaded virtualenv1.7.2 and after getting this error updated it by running: pip install virtualenv. Here is the successful installation message from this:
Downloading/unpacking virtualenv
Downloading virtualenv-1.11.6-py2.py3-none-any.whl (1.6MB): 1.6MB downloaded
Installing collected packages: virtualenv
Successfully installed virtualenv
Cleaning up...
Can someone please help me resolve the above error?
Thanks #MattDMo for cluing me in.
I indeed have multiple virtualenvs installed so I ran sudo pip uninstall virtualenv and then sudo pip install virtualenv and this resolved the above error.

Resources