Installing Fuel (Machine Learning) using pip on Ubuntu 14.04.02 - python

When installing the Fuel machine learning library, I got stuck with some dependencies issues:
alvas#ubi:~$ pip install --upgrade git+git://github.com/mila-udem/fuel.gitYou are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting git+git://github.com/mila-udem/fuel.git
Cloning git://github.com/mila-udem/fuel.git to /tmp/pip-xUlqCT-build
/usr/local/lib/python2.7/dist-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
Collecting numpy (from fuel==0.0.1)
Requirement already up-to-date: six in /usr/local/lib/python2.7/dist-packages (from fuel==0.0.1)
Collecting picklable-itertools (from fuel==0.0.1)
Downloading picklable-itertools-0.1.1.tar.gz
Collecting pyyaml (from fuel==0.0.1)
Downloading PyYAML-3.11.tar.gz (248kB)
100% |████████████████████████████████| 249kB 612kB/s
Collecting h5py (from fuel==0.0.1)
Downloading h5py-2.5.0.tar.gz (684kB)
100% |████████████████████████████████| 688kB 398kB/s
Collecting tables (from fuel==0.0.1)
Downloading tables-3.2.2.tar.gz (7.0MB)
100% |████████████████████████████████| 7.0MB 73kB/s
Complete output from command python setup.py egg_info:
/usr/bin/ld: cannot find -lhdf5
collect2: error: ld returned 1 exit status
* Using Python 2.7.6 (default, Jun 22 2015, 17:58:13)
* USE_PKGCONFIG: True
.. ERROR:: Could not find a local HDF5 installation.
You may need to explicitly state where your local HDF5 headers and
library can be found by setting the ``HDF5_DIR`` environment
variable or by using the ``--hdf5`` command-line option.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-wMS1d3/tables
Then after I have done (Installing h5py on an Ubuntu server):
sudo apt-get install libhdf5-dev
sudo HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/serial/ pip install h5py
And then I had to also update my cython with:
sudo pip install cython
My question is not about how to fix the installation issues but what does this command mean?
sudo HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/serial/ pip install h5py
What does specifying the HDF5_DIR do?
Why didn't the fuel dependencies automatically install from the:
https://github.com/mila-udem/fuel/blob/master/requirements.txt
https://github.com/mila-udem/fuel/blob/master/setup.py
What should I do to update the setup.py from fuel so that it can automatically pip install the dependencies?

You do not need to make any modifications to the setup.py from fuel. Just make sure HDF5_DIR is set correctly before updating the lib.
Explanations:
If you look at your error log, you can see that it fails at installing the h5py python lib that is a dependency of fuel. It also tells you why it failed at the end, basically it is because h5py use the C library hdf5 and it needs the headers of this lib to use it.
So the sudo apt-get install libhdf5-dev that you executed is to install the development version of this C library (you can gess that by the -dev). The dev versions install the headers of the lib and not just the compiled lib.
Then, the HDF5_DIR env variable is nedded to tell h5py setup where to find those headers.
So if you whant to update the fuel lib next time, make sure that the HDF5_DIR is set correctly and then it will update its dependencies (including h5py).

Related

How do I install pipwin properly, it installs but then it's not recognized as a command

So I am trying to install pyaudio and it gives the _portaudio error, so people online told me to install it through pipwin, so I run this command:
pip install pipwin
Then when i type:
pipwin install pyaudio
This shows up:
'pipwin' is not recognized as an internal or external command,
operable program or batch file.
So i reboot, thinking that's the problem. Same message. Then I go ahead and uninstall pipwin and installs it again to find any potential errors that I missed. This shows up in red text:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
conda-repo-cli 1.0.4 requires pathlib, which is not installed.
anaconda-project 0.10.1 requires ruamel-yaml, which is not installed.
cookiecutter 1.7.2 requires Jinja2<3.0.0, but you have jinja2 3.0.3 which is incompatible.
cookiecutter 1.7.2 requires MarkupSafe<2.0.0, but you have markupsafe 2.0.1 which is incompatible.
Now I think oh, let's just install pathlib.
pip install pathlib
but then, ofcourse it's not that easy:
Collecting pathlib
Using cached pathlib-1.0.1.tar.gz (49 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
So i go ahead and try downloading setup tools, only for this to happen:
Collecting setuptools
Downloading setuptools-60.10.0-py3-none-any.whl (1.1 MB)
---------------------------------------- 1.1/1.1 MB 8.6 MB/s eta 0:00:00
Installing collected packages: setuptools
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
spyder 5.1.5 requires pyqt5<5.13, which is not installed.
spyder 5.1.5 requires pyqtwebengine<5.13, which is not installed.
conda-repo-cli 1.0.4 requires pathlib, which is not installed.
anaconda-project 0.10.1 requires ruamel-yaml, which is not installed.
astroid 2.6.6 requires wrapt<1.13,>=1.11, but you have wrapt 1.13.3 which is incompatible.
Successfully installed setuptools-60.10.0
What is happening, why is it failing. Even more of a mindblow is that this is like 3 levels of just errors, trying to install PyAudio. Please help, this worked before I switched hard drives and had to reinstall Windows.
Sometimes when i install a module, i have to use py -m pip install {module} after cd C:\. Also make sure you have latest versions on pip.

Unable to install pylint with pip in python 3.9

I am starting to use VS Code, but pylint is not installed and it gives me an error.
I try to install pylint using pip, but it gives me an error code.
Collecting pylint
Using cached pylint-2.6.0-py3-none-any.whl (325 kB)
Collecting astroid<=2.5,>=2.4.0
Using cached astroid-2.4.2-py3-none-any.whl (213 kB)
Collecting colorama
Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting isort<6,>=4.2.5
Using cached isort-5.6.4-py3-none-any.whl (98 kB)
Collecting lazy-object-proxy==1.4.*
Using cached lazy-object-proxy-1.4.3.tar.gz (34 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
WARNING: Requested lazy-object-proxy==1.4.* from https://files.pythonhosted.org/packages/07/3f/a3d687f83c7d44970f70ff0400677746c8860b11f0c08f6b4e07205f0cdc/lazy-object-proxy-1.4.3.tar.gz#sha256=f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0 (from astroid<=2.5,>=2.4.0->pylint), but installing version 0.0.0
ERROR: Requested lazy-object-proxy==1.4.* from https://files.pythonhosted.org/packages/07/3f/a3d687f83c7d44970f70ff0400677746c8860b11f0c08f6b4e07205f0cdc/lazy-object-proxy-1.4.3.tar.gz#sha256=f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0 (from astroid<=2.5,>=2.4.0->pylint) has different version in metadata: '0.0.0'```
This is a bug of pip for now, see https://github.com/pypa/pip/issues/9203. The pip does something wrong in its package-dependencies handling. And there is a workaround listed in this issue, use --use-deprecated=legacy-resolver. And be noted: This will work until we release pip 21.0.
So run pip install --use-deprecated=legacy-resolver pylint will resolve this problem. This works for me on win10, finally I got lazy-object-proxy 0.0.0 and pylint 2.6.0 installed, though 0.0.0 is kinda weird.
I had the same issues with Python 3.9 & Pylint.
Even when I tried the answers given here, nothing worked. I kept on getting Error messages.
All my issues where fixed by doing the following:
Uninstalled Python 3.9.1
Installed Python 3.7.9 - (Remember to click the box add to PATH)
Verifying Python Installation:
3.1 python --version, This should give you Python 3.7.9
If it doesn't and you get an Error, you need to configure your PATH, here is a video on how to fix that:
https://www.youtube.com/watch?v=vWxQG70GqT4&list=PL914uJ85wHwJ4WYvHEhPHSgG2oyi7Azat&index=11&ab_channel=KyleCook
Verifying pip Installation:
4.1 pip --version (I got another Error here again)
i.e.: ModuleNotFoundError: No module named 'pip' python3
I fixed that by:
4.1.1 python -m ensurepip
4.1.2 python -m pip install --upgrade pip
Ref: ModuleNotFoundError: No module named 'pip' python3
Install Pylint for Python 3.6+:
5.1 pip install pylint --upgrade
Ref: https://pypi.org/project/pylint/
This worked for me.

Sagemaker lifecycle configuration for installing pandas not working

I am trying to update pandas within a lifecycle configuration, and following the example of AWS I have the next code:
#!/bin/bash
set -e
# OVERVIEW
# This script installs a single pip package in a single SageMaker conda environments.
sudo -u ec2-user -i <<EOF
# PARAMETERS
PACKAGE=pandas
ENVIRONMENT=python3
source /home/ec2-user/anaconda3/bin/activate "$ENVIRONMENT"
pip install --upgrade "$PACKAGE"==0.25.3
source /home/ec2-user/anaconda3/bin/deactivate
EOF
Then I attach it to a notebook and when I enter the notebook and open a notebook file, I see that pandas have not been updated. Using !pip show pandas I get:
Name: pandas
Version: 0.24.2
Summary: Powerful data structures for data analysis, time series, and statistics
Home-page: http://pandas.pydata.org
Author: None
Author-email: None
License: BSD
Location: /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages
Requires: pytz, python-dateutil, numpy
Required-by: sparkmagic, seaborn, odo, hdijupyterutils, autovizwidget
So we can see that I am indeed in the python3 env although the version is 0.24.
However, the log in cloudwatch shows that it has been installed:
Collecting pandas==0.25.3 Downloading https://files.pythonhosted.org/packages/52/3f/f6a428599e0d4497e1595030965b5ba455fd8ade6e977e3c819973c4b41d/pandas-0.25.3-cp36-cp36m-manylinux1_x86_64.whl (10.4MB)
2020-02-03T12:33:09.065+01:00
Requirement already satisfied, skipping upgrade: pytz>=2017.2 in ./anaconda3/lib/python3.6/site-packages (from pandas==0.25.3) (2018.4)
2020-02-03T12:33:09.065+01:00
Requirement already satisfied, skipping upgrade: python-dateutil>=2.6.1 in ./anaconda3/lib/python3.6/site-packages (from pandas==0.25.3) (2.7.3)
2020-02-03T12:33:09.065+01:00
Requirement already satisfied, skipping upgrade: numpy>=1.13.3 in ./anaconda3/lib/python3.6/site-packages (from pandas==0.25.3) (1.16.4)
2020-02-03T12:33:09.065+01:00
Requirement already satisfied, skipping upgrade: six>=1.5 in ./anaconda3/lib/python3.6/site-packages (from python-dateutil>=2.6.1->pandas==0.25.3) (1.13.0)
2020-02-03T12:33:09.065+01:00
Installing collected packages: pandas Found existing installation: pandas 0.24.2 Uninstalling pandas-0.24.2: Successfully uninstalled pandas-0.24.2
2020-02-03T12:33:12.066+01:00
Successfully installed pandas-0.25.3
What could be the problem?
if you want to install the packages only in for the python3 environment, use the following script in your Create Sagemaker Lifecycle configurations.
#!/bin/bash
sudo -u ec2-user -i <<'EOF'
# This will affect only the Jupyter kernel called "conda_python3".
source activate python3
# Replace myPackage with the name of the package you want to install.
pip install pandas==0.25.3
# You can also perform "conda install" here as well.
source deactivate
EOF
Reference : "Lifecycle Configuration Best Practices"
I have encountered the exact same problem when package was not available in the notebook while Lifecycle Cloudwatch indicated successful installation for the specific kernel. The solution that worked for me is to make sure installation completes before opening up notebook.

Why does pybrain 0.3.1 install instead of 0.3.3?

I'm having trouble installing the proper version of PyBrain. This is a problem.
(rnine) ronaldo#ronaldo-laptop:~$ pip install https://github.com/pybrain/pybrain/archive/0.3.3.zip
Collecting https://github.com/pybrain/pybrain/archive/0.3.3.zip
Downloading https://github.com/pybrain/pybrain/archive/0.3.3.zip
\ 1.5MB 1.4MB/s
Requirement already satisfied: scipy in ./.conda/envs/rnine/lib/python3.5/site-packages (from PyBrain==0.3.1)
Installing collected packages: PyBrain
Running setup.py install for PyBrain ... done
Successfully installed PyBrain-0.3.1
As you can see, it keeps installing PyBrain 0.3.1 even though I'm pulling in the 0.3.3 folder. Why is this happening and how can I fix this.
Download this package and see its setup.py, you will see version="0.3.1", so this is a bug made by author.
You have nothing to do with it except for modifying source code by yourself.

Error: Failed building wheel for wxpython-phoenix while installing wx

I am trying to install wxpython (I have python 3.5.2(32Bit) and Windows 10(64Bit))
I tried :pip install wx and i get: Failed building wheel for wxpython-phoenix 2 times and then a big error line-->
I also tried installing Anaconda, but it did not help.How can I overcome the problem ?
There's a lot of questions about failed installations on windows, probably because the packages are compiled when installed, and sometimes the compilation fail when the compiler is not properly configured. I admit I decided to let the specialized people handle it.
As a nice workaround, you can grab the already built distribution at the official wxpython website located here:
Python 3.5 32/64 bit windows:
https://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev2700+c524ed1-cp35-cp35m-win_amd64.whl
https://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev2700+c524ed1-cp35-cp35m-win32.whl
just download the .whl file and do for example:
C:\python35\scripts\pip install wxPython_Phoenix-3.0.3.dev2700+c524ed1-cp35-cp35m-win_amd64.whl
For linux you need to go here first
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/
Then grab your linux version and do the install.
(base) fsdfsdfd#linux:~/Downloads$ pip install wxPython-4.1.1-cp38-cp38-linux_x86_64.whl
Processing ./wxPython-4.1.1-cp38-cp38-linux_x86_64.whl
Requirement already satisfied: pillow in /home/orangel/miniconda3/lib/python3.8/site-packages (from wxPython==4.1.1) (8.1.2)
Requirement already satisfied: numpy; python_version >= "3.0" in /home/orangel/miniconda3/lib/python3.8/site-packages (from wxPython==4.1.1) (1.20.1)
Requirement already satisfied: six in /home/orangel/miniconda3/lib/python3.8/site-packages (from wxPython==4.1.1) (1.15.0)
Installing collected packages: wxPython
Successfully installed wxPython-4.1.1
if does not works, please try this
sudo apt install libwxgtk3.0-gtk3-dev

Categories