I am pretty new to python. I want to use KMean code, and I want to install scikit-learn or sklearn.
I used this code to attempt install these packages:
pip install -U sklearn
pip install -U scikit-learn
But I got this error:
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_reihaneh/sklearn/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-89YQB7-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_reihaneh/sklearn
Storing debug log for failure in /home/reihaneh/.pip/pip.log
What is the cause of the problem?
pip install -U <package>, short for pip install --upgrade <package>, will upgrade <package> to the most recent stable version in the pip repo.
pip install <package> will install the most recent stable version of <package> in the pip repo.
The difference is upgrading vs. installing. You want the latter.
scikit-learn requires scipy and numpy, so here are the commands you should issue:
pip install numpy
pip install scipy
pip install scikit-learn
If you already have any of the dependencies, just plug in a -U between pip install and the package name.
If you're using Python 3.x, replace pip with pip3.
Related
I would like to preface that I am very inexperienced with programming and I am probably going to use some incorrect terminology, so bear with me. I am pissed off at bots buying out stock of graphics cards in seconds, leaving me unable to buy any, so I've decided to fight fire with fire. I will not be scalping graphics cards. I have morals.
When I run py -m pip install --upgrade pip in the terminal, it returns Requirement already satisfied: pip in c:\users\awsmcube\pycharmprojects\3060tibot\venv\lib\site-packages (21.0.1). When I run py -m pip --version, it returns pip 21.0.1 from C:\Users\AWSMcube\PycharmProjects\3060tibot\venv\lib\site-packages\pip (python 3.7).
However, when I try running pip install Scrapy, it returns a long error code: Command "C:\Users\AWSMcube\PycharmProjects\3060tibot\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\AWSMcube\\AppData\\Local\\Temp\\pip-install-97nzwr21\\cryptography\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read() .replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\AWSMcube\AppData\Local\Temp\pip-record-4yro5d1x\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\AWSMcube\PycharmProjects\3060t ibot\venv\include\site\python3.7\cryptography" failed with error code 1 in C:\Users\AWSMcube\AppData\Local\Temp\pip-install-97nzwr21\cryptography\, along with this suggestion: You are using pip version 10.0.1, however version 21.0.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. This brings me back to upgrading pip, which I have done as seen in the previous paragraph.
Why is it telling me that I am using pip version 10.0.1 when I already installed pip version 21.0.1? I have already tried restarting PyCharm.
I tried to install matplotlib ( third party lib) on gcp vm and failed.
gcp vm python documantation says use pip install -t lib/ <library_name> but actually, what they really mean: i.g. use pip install matplotlib -t lib/ <library_name> And it didn't work
I tried:
sudo pip install matplotlib -t env/gcplib
result:
"**Failed building wheel for subprocess32**"
"Command "/usr/bin/python -u -c "import setuptools,
tokenize;__file__='/tmp/pip-install-Rpkv8i/subprocess32/setup.py
';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __fi
le__, 'exec'))" install --record /tmp/pip-record-x4Y1E4/install-record.txt --single-version-externally-managed --co
mpile" **failed with error code 1** in /tmp/pip-install-Rpkv8i/subprocess32/"
I will very appreciate any help
Before attempting to install matplotlib, you need to install python-dev. You didn't mention what OS your VM was, but if it's Ubuntu, you would do that with:
sudo apt-get install python-dev
I am running ubuntu 16. I have both python 2.7 and 3.5 installed. I want to install cx_freeze latest version for python3. I downloaded the package from their website but couldn't run the setup.py file as it always gave me errors. Also i have installed pip3, but it still doesn't work for me. all the answers online are for older version of cx_freeze so a fresh answer for the new version will be helpful.
I install and upgrade pip3 with:
sudo -H install --upgrade pip
then I try to install cx_freeze with:
pip3 install cx_Freeze .
then i get the following errors:
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ngco46uq/cx-Freeze/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-q3n3cd2r-record/install-record.txt --single-version-externally-managed --compile"
failed with error code 1 in /tmp/pip-build-ngco46uq/cx-Freeze/
also anyone can tell me any other method to do so ?
Try installing Pip3 using :
sudo apt-get install python3-pip
If you have Python 2.7, you can try alternatives like py2exe
I have Python 2.7.9 on windows 7 64-bits. I'm trying to install scipy using pip. I used pip install scipy but I get the following error :
Command "C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\us
ers\\admin\\appdata\\local\\temp\\pip-build-xpl5cw\\scipy\\setup.py';exec(compil
e(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file
__, 'exec'))" install --record c:\users\admin\appdata\local\temp\pip-b68pfc-reco
rd\install-record.txt --single-version-externally-managed --compile" failed with
error code 1 in c:\users\admin\appdata\local\temp\pip-build-xpl5cw\scipy
I searched on google and stackoverflow for solutions but nothing worked. I tried upgrading pip and it didn't work too.
Here are my installed packages and their versions :
httplib2 (0.9.1)
nltk (3.0.3)
nose (1.3.7)
numpy (1.9.2)
pip (7.0.3)
pytz (2015.4)
scikit-learn (0.16.1)
setuptools (17.1.1)
six (1.9.0)
twilio (4.4.0)
wheel (0.24.0)
I'm on Ubuntu 14.04. I tried installing through pip which kept on failing with error code 1 or took forever to finish (never finished actually!).
However, the following command worked without a hitch:
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
Reference: http://www.scipy.org/install.html
On Windows, you'll need to use the unofficial precompiled binaries:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Select the version matching your architecture and Python version.
Installing setuptools made it work for me (Mac OS)
pip install -U pip setuptools
I also had the same error when installing scipy.
Then I downloaded and installed MiniConda. And then I used the below command to install pytables.
conda install -c conda-forge scipy
Please refer the below screenshot.
On windows you can check below command:
python -m pip install psycopg2
I made a program in Python3 which uses the package netifaces, I installed it with pip3 in two computers which had Ubuntu 13.04 and Ubuntu 13.10. However, I need to install it in other computer which has Ubuntu 12.04, and here I cannot install pip3 (python3-pip) because it is not on the repositories.
What I did was the next steps:
sudo aptitude install python3-setuptools
sudo easy_install3 pip
And then I had pip3 available. The problem is when I tried to install netifaces with pip3, which gives me next error:
error: command 'gcc' failed with exit status 1
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/netifaces/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-gkaftl-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/netifaces
Storing debug log for failure in /home/anubia/.pip/pip.log
If I install netifaces with pip or aptitude or apt-get the program does not recognise the library, because its documents are installed in python2 folders. I even tried to do a symbolic link from python3 folders to them, but it did not work.
Any ideas, please?
Solved!
I had to install the package python3-dev too, then the installation of netifaces from pip3 did not give me an error and now I can use it.
So the whole process (in my case) was:
sudo aptitude install python3-setuptools
sudo easy_install3 pip
sudo aptitude install python3-dev
sudo pip3 install netifaces