SKLearn and Scipy not installing thorugh pip with Python 3.6 - python

I am trying to install sklearn, and hitting wall after wall. When I first tried to install it through pip, it started flipping out about scipy. I went and installed the scipy wheel file, and the numpy+mkl wheel file after that. After some more errors and such, I tried reinstalling everything. Still nope. Tried updating setuptools just to be sure, still nope. This time, I try again and after considerable time and a huge wall of text, if stops with this error:
Command "C:\Users\ZackPC\AppData\Local\Programs\Python\Python36-32\python.exe
-u -c "import setuptools,
tokenize;__file__='C:\\Users\\ZackPC\\AppData\\Local\\Temp\\pip-build-
gowcc39f\\scikit-learn\\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\ZackPC\AppData\Local\Temp\pip-
_y2kd8u6-record\install-record.txt --single-version-externally-managed --
compile" failed with error code 1 in C:\Users\ZackPC\AppData\Local\Temp\pip-
build-gowcc39f\scikit-learn\
Searching this error gets me right back to one of the beginning threads I searched through, this one, which has a similar error. I've tried pretty much everything in there to no avail. Anybody have ideas?

Anaconda is the easiest solution. I recall before I used anaconda that you can't include scipy and numpy in the same requirements file as each depends on the other so you have to install them in the right sequence. Then there were other errors around versions of linalg and other packages; and of course it takes forever to compile them.

Related

pip install scikit-learn error

the error is
Command "c:\users\samuel\appdata\local\programs\python\python37\python.exe -
u -c "import setuptools,
tokenize;__file__='C:\\Users\\Samuel\\AppData\\Local\\Temp\\pip-install-
bnoak8r5\\scikit-learn\\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\Samuel\AppData\Local\Temp\pip-
record-4yww_x3p\install-record.txt --single-version-externally-managed --
compile" failed with error code 1 in C:\Users\Samuel\AppData\Local\Temp\pip-
install-bnoak8r5\scikit-learn\
on the website its says this
Python (>= 2.7 or >= 3.3),
NumPy (>= 1.8.2),
SciPy (>= 0.13.3).
i have python 3.7
numpy 1.14.3 and scipy 1.1.0
so is my python version to new along with my scipy version?
when i download the file and try to install it i get this error
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Samuel\AppData\Local\Temp\pip-req-build-6eptglns\
I suggest you download Anaconda and use conda install as your package manager for numpy, scipy, scikit-learn, etc. I can't guarantee it will fix this problem but it most certainly will be better at what you are using scikit-learn for. It would certainly change this error because it downloads a new installation of python somewhere else within anaconda's directories. Doing this has fixed this same problem for some people in the past.
I hope this helps.

Trouble installing PySide on Mac

I have been having a lot of trouble installing PySide. I installed Qt with brew install qt as suggested in this tutorial: pyside.readthedocs.io/en/latest/installing/macosx.html.
My Mac is updated to High Sierra 10.13.3. When I run pip install -U Pyside, I get the following printout:
Failed building wheel for Pyside
Running setup.py clean for Pyside
Failed to build Pyside
Installing collected packages: Pyside
Running setup.py install for Pyside ... error
Complete output from command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/4x/bkrfh91103936h2x82l9x_480000gn/T/pip-build-HTn1Jd/Pyside/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/4x/bkrfh91103936h2x82l9x_480000gn/T/pip-nRGV6n-record/install-record.txt --single-version-externally-managed --compile:
Removing /private/var/folders/4x/bkrfh91103936h2x82l9x_480000gn/T/pip-build-HTn1Jd/Pyside/pyside_package
running install
running build
Python architecture is 64bit
error: Failed to find qmake. Please specify the path to qmake with --qmake parameter.
Command
"/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/4x/bkrfh91103936h2x82l9x_480000gn/T/pip-build-HTn1Jd/Pyside/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/4x/bkrfh91103936h2x82l9x_480000gn/T/pip-nRGV6n-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/4x/bkrfh91103936h2x82l9x_480000gn/T/pip-build-HTn1Jd/Pyside/
Any ideas on how to fix this? Thanks!
PySide is 4 years out of date and essentially dead, and doesn't work with any Qt later than 4.8. But the instructions you're following (probably also 4 years out of date) tell you to install the latest Qt, which at the moment is 5.10.
To work around this, you need to explicitly install Qt 4.8. You may be able to do this with Homebrew:
brew install qt#4.8
But I haven't tested whether that works.
Also, Homebrew's Qt package installs as a "keg-only" link by default nowadays. That may not have been true when the old tutorial you're following was written. In which case you may need to follow the instructions given in the output of that brew install, which will be something like this:
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/qt/lib
CPPFLAGS: -I/usr/local/opt/qt/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/qt/lib/pkgconfig
If this all sounds like a mess—or if you just don't want to be stuck on Qt 4.8 forever—then you probably don't actually want to use PySide. There are two major alternatives:
PySide2 was designed by the PySide core devs together with the official Qt company as a replacement for PySide which works with Qt 5 (and, presumably, beyond), and newer versions of OS X (and other platforms) and Python 3, and fixes some problems that couldn't be fixed without a breaking change. This isn't yet in stable 1.0 state, but it has already been used for real projects. (I believe the goal is to start versioning it in sync with Qt itself once it's finished, so the first stable version may be something like 5.11 or 5.12, not 1.0.)
PyQt is a different library from a separate company. It's working and stable today, but it doesn't have the same license terms as PySide and doesn't have direct support from the Qt company. (IIRC, you can get commercial licensing or GPL licensing, but not LGPL—but don't trust me; check it yourself.)
(There is actually a port of PySide to Qt5 by Christian Tismer, but as far as I know he abandoned it a couple years ago to take leadership of the PySide2 project instead, and the old version was left unfinished, so I wouldn't bother searching for that.)
Of course if you're following tutorials for Qt4 and PySide, you'll need to replace those with newer tutorials if you go with Qt5 and PySide2 or PyQt.

Why is pip install mysql-connector fail?

I'm just trying to simply install python-myconnector using the very simple instructions provided here.
But it is failing. Here is the error I get:
(my_virtual_env) [my.username#my_machine ~]$ pip install mysql-connector
...
Command "/home/my.username/my_virtual_env/bin/python2.7 -u -c
"import setuptools, tokenize;
__file__='/tmp/pip-build-rLJbLN/mysql-connector/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-mFh5Pg-record/install-record.txt
--single-version-externally-managed
--compile
--install-headers
/home/me/my_virtual_env/include/site/python2.7/mysql-connector"
failed with error code 1 in /tmp/pip-build-rLJbLN/mysql-connector/```
The full error log can be found here if you need to see it (but I doubt you will)
Why is this happening and how can I fix it?? Also, FYI, I don't have sudo access on this machine. So that's why I am installing it into a virtual environment..
FYI, it seems like it was supposed write something into /tmp/pip-build-rLJbLN/ but didn't and then it blows up later on when it tries to read from what it was supposed to have written there earlier. So how do I fix this bug??
I have read other solutions to other similar problem here. But I couldn't get any of them to work for me.
The mysql-connector clearly states that it requires protobuf
mysql-connector (version >= 2.2.3) requires Protobuf C++ (version >= 2.6.0)
Just as I commented, your error log insists the same:
Line 81, 165: Unable to find Protobuf include directory.
Based on your platform, follow this protobuf C++ installaion instruction, and export the protobuf path so that pip can refer that path

Scipy Python wheel

I have got a problem with installing Scipy on my Python 2.7 , Windows in IPython.
When I enter "pip install scipy", I have one first error message:
"Failed building wheel for scipy" and then at the end
"
Command "c:\python27\python.exe -c "import setuptools,tokenize;__file__='c:\\us
ers\\admini~1\\appdata\\local\\temp\\pip-build-e3yebj\\scipy\\setup.py';exec(com
pile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __f
ile__, 'exec'))" install --record c:\users\admini~1\appdata\local\temp\pip-mwhxl
d-record\install-record.txt --single-version-externally-managed --compile" faile
d with error code 1 in c:\users\admini~1\appdata\local\temp\pip-build-e3yebj\sci
py
"
I do not know how to solve that problem, thanks if you have any ideas
You can download the wheel from this web site:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
You need to pick the right one. So, for
scipy‑0.19.0‑cp34‑cp34m‑win32.whl
cp34 means it will work with python 3.4
make sure you go with this one in your case:
scipy‑0.19.0‑cp27‑cp27m‑win32.whl and whatever your windows is (32 or 64).
once downloaded, go to the command line and put:
python -m pip install scipy‑0.19.0‑cp27‑cp27m‑win32.whl (making sure it is sitting in the right directory).
That should solve the problem.
I also met this problem and I then installed a Python distribution like Anaconda instead!

Installing NumPy on Windows 8.1 with Python 2.7.x

I'm very new to Python and programming world and has been going along with tutorials from newcoder.io This Here! I have been doing as per the instructions but when I try to install NumPy I get an error.
"
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it from http://aka.ms/vcpython27
Command "C:\Users\HP.virtualenvs\DataVizProj\Scripts\python.exe -c "import setuptools, tokenize;file='c:\users
\appdata\local\temp\pip-build-lsj5sj\numpy\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).re
.replace('\r\n', '\n'), file, 'exec'))" install --record c:\users\hp\appdata\local\temp\pip-6jei4k-record\instal
cord.txt --single-version-externally-managed --compile --install-headers C:\Users\HP.virtualenvs\DataVizProj\includ
te\python2.7" failed with error code 1 in c:\users\hp\appdata\local\temp\pip-build-lsj5sj\numpy
"
But that's not enough, I tried to install VCForPython27.msi from the given link. But still, gets the same error.
Please Help!
I recommend installing the Anaconda distribution of Python. It contains more packages than you can dream of, including numpy of course: http://continuum.io/downloads
The installation is as straightforward as installing the usual Python, no matter what OS you are on.
A good solution is to download the wheel file which match your Python version here:unofficial python binaries
And then go to the folder where the .whl file is present using the command prompt and unpack the wheel file xxxxx.whl with:
>python -m pip install xxxxx.whl
This will install the library in the Lib\site-packages folder, you can check it afterwards.

Categories