I would like to install python 3.5 packages so they would be available in Jupyter notebook with pyspark3 kernel.
I've tried to run the following script action:
#!/bin/bash
source /usr/bin/anaconda/envs/py35/bin/activate py35
sudo /usr/bin/anaconda/envs/py35/bin/conda install -y keras tensorflow theano gensim
but the packages get installed on python 2.7 and not in 3.5
You can use:
#!/usr/bin/env bash
/usr/bin/anaconda/envs/py35/bin/conda install -y ...
or (if conda doesn't have the package)
/usr/bin/anaconda/envs/py35/bin/pip install ...
According to the help information of the command conda help install, there is a parameter -n ENVIRONMENT to do the package installation on a specified environment like envs/py35, the explaination as below.
$ conda help install
.......
-n ENVIRONMENT, --name ENVIRONMENT
Name of environment (in
/home/sshuser/.conda/envs:/usr/bin/anaconda/envs).
So you can install these packages you want via the command as below.
sudo /usr/bin/anaconda/bin/conda install -y keras tensorflow theano gensim -n py35
Hope it helps.
Have you tried installing using pip?
In some cases where you have both Python 2 and Python 3, you have to run pip3 instead of just pip to invoke pip for Python 3.
Related
I am using an EC2 instance with Deep Learning AMI based on Ubuntu 18.04.
I am doing the following:
Start the terminal
Activate the conda environment: conda activate tensorflow2_latest_p37
Install the package pip3 install tensorrt
Run my code python3 mycode.py
And I get the following error:
ModuleNotFoundError: No module named 'tensorrt'
I also trying to install as sudo or with -U or -m option. Nothing work. I can't install with conda install because tensorrt is not available in it.
pip3 will use ubuntu's level pip3, not from anaconda. You can confirm this by using which pip3 after you activate your environemnt. ALso tensorrt is not available for python other then 3.6
So to install tensorrt on Ubuntu 18.04 Deep Learnig:
conda activate tensorflow2_p36
# then in tensorflow2_p36 environment
pip install nvidia-pyindex
pip install --upgrade nvidia-tensorrt
Can someone please tell me how to downgrade Python 3.6.9 to 3.6.6 on Ubuntu ? I tried the below commands but didnot work
1) pip install python3.6==3.6.6
2) pip install python3.6.6
First, verify that 3.6.6 is available:
apt-cache policy python3.6
If available:
apt-get install python3.6=3.6.6
If not available, you'll need to find a repo which has the version you desire and add it to your apt sources list, update, and install:
echo "<repo url>" >> /etc/apt/sources.list.d/python.list
apt-get update
apt-get install python3.6=3.6.6
I advise against downgrading your system python unless you're certain it's required. For running your application, install python3.6.6 alongside your system python, and better yet, build a virtual environment from 3.6.6:
apt-get install virtualenv
virtualenv -p <path to python3.6.6> <venv name>
One option is to use Anaconda, which allows you to easily use different Python versions on the same computer. Here are the installation instructions for Anaconda on Linux. Then create a Conda environment by running this command:
conda create --name myenv python=3.6.6
Obviously your can use a different name than "myenv". You can then activate the environment in any terminal window:
conda activate myenv
Then you can pip install any packages you want. Some basics of anaconda environments can be found on the website's getting started page.
I'm trying to upgrade to Tensorflow 1.9 within a conda environment (Ubuntu 16.04). I am using python 3.6.5. When I try this:
source activate myenv
sudo -H pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp36-cp36m-linux_x86_64.whl
I get the error:
tensorflow-1.9.0rc0-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform.
Seems strange because the same thing worked fine for TF 1.8
TensorFlow seems to install fine without sudo -H but then when I try:
python -c "import tensorflow as tf; print(tf.__version__)"
I get the following error:
from tensorflow.python.keras._impl.keras.backend import abs
ImportError: cannot import name 'abs'
I can't install from conda because it still has 1.8 when I check with:
conda install -c conda-forge tensorflow
With sudo you're installing locally. So, remove sudo -H to install over your Environment.
also, you need the python developer library locally:
Ubuntu: apt-get install python3-dev
RHEL/Fedora: dnf install python3-devel
Mac OS: check your environment variables or try re-installing?
Windows: check your environment variables or try re-installing?
Sometimes because of outdated pip also this can happen . Try this inside that environment and let me know
python -m pip install --upgrade pip
Try to check if conda has 1.9
conda install -c conda-forge tensorflow
I figured out that this Tensorflow is a pre-release not the complete release, as a result you can upgrade it using pip directly.
You can remove your installed release and try to install this else wait for couple of weeks after that you can directly update via conda forge or pip.
Python2.6 was installed by default in my old centos server. Now I want to create a Python3 environment to install python3 specific module by conda
conda create -n py3 python=3.5.3
source activate py3
After activate the py3, I try to install hovercraft by pip3 install hovercraft, the shell tells "command not found: pip3". At first I thought pip3 was installed with Python3, but the result was not the case.
So I think I can install it manually. The package gzip file was downloaded from python package index, and install by conda install --file hovercraft-2.3.tar.gz. But it doesn't work.
Now I have two problems:
how to install pip3 for virtual-env create by conda?
Is it possible to install python package index downloaded package locally in conda?
pip3 and pip would make a difference only when you are not using any environment managers like virualenv (or) conda. Now as you are creating a conda environment which has python==3.x, pip would be equivalent to pip3.
I've setup anaconda and created a python 3.3 environment. Now I wanted to install some package (dataset). The install instructions ask to clone the git repo and run
python setup.py install
but now the packages are not installed to the environments site-packages folder but to a different anaconda location.
What are the normal steps to solve that problem? Newbie-compatible solutions are preferred. The OS is MacOSX, just is case, it is relevant.
It looks like conda automatically adds pip to your conda environment, so after you source your conda environment, i.e.:
source activate ~/anaconda/envs/dataset
you should be able to install it like this:
git clone git://github.com/pudo/dataset.git
pip install ./dataset
EDIT
Here are the exact steps I took:
$ conda create -p ~/anaconda/envs/py33 python=3.3 anaconda pip
$ source activate ~/anaconda/envs/py33
$ which pip
~/anaconda/envs/py33/bin/pip
$ pip install ./dataset/