I cannot run conda command /activate environment on ubuntu? - python

I have installed anaconda in ubuntu and am facing a problem with anaconda. I was running the following command in a conda environment:
271 pip install --user -r requirements.txt
272 cd ..
273 conda install ipython jupyter
274 conda install jupyter
275 python
276 sudo apt-get install python-vtk python-wxgtk2.6 python-setuptools python-numpy python-configobj
277 sudo apt-get install python-vtk python-wxgtk2.8 python-setuptools python-numpy python-configobj
278 conda install -c anaconda mayavi==4.5.0
It suddenly stopped working. Once I want to activate an environment or run any command with conda, I am receiving the following error:
ERROR: The install method you used for conda--probably either `pip install conda`
or `easy_install conda`--is not compatible with using conda as an application.
If your intention is to install conda as a standalone application, currently
supported install methods include the Anaconda installer and the miniconda
installer. You can download the miniconda installer from
https://conda.io/miniconda.html.
I have even added export PATH=/home/user/anaconda2/bin:$PATH to .bashrc. Could someone please help?

pip install conda can corrupt the conda setup. Download miniconda setup from the path in the error and run below
bash Miniconda3-latest-Linux-x86_64.sh -f
To test your installation, enter the command conda --version. If installed correctly, you will see the version of conda installed.

Related

what where and how of pip when mixed with virtual environments

What i think i know currently is this:
The way to install pip is sudo apt-get install python-pip
sudo apt-get install python-pip installs pip at '/usr/lib/python3/dist-packages'
pip install abc installs abc to virtualenv where pip that gets called is
I use conda, and i have an environment 'env' created with it for some time now. I needed to install a package that said i needed pip3 > 19.0.1 so i which pip and it was 9.0.2 and it was well within the environment. i updated the pip using python -m pip install --upgrade pip and it got upgraded to 20.0.2. I am happy. However, which pip3 gives me global location, version 9.0.2 and the package i am going to be installing requires pip3 install .. command and conda install pip3 doesn't exist
questions:
How do i install pip3 in a conda environment?
Supposing i did not have conda install pip or let us say i had a non conda virtualenv created, how do i go about installing a pip in this environment so that pip install ... does not install to global location?

How to install Rasa NLU using Anaconda prompt

I have anaconda installed, and I use Anaconda Prompt to install python packages. But I'm unable to install RASA-NLU using conda prompt. Please let me know the command for the same
I have used the below command:
conda install rasa_nlu
Error:
PackagesNotFoundError: The following packages are not available from current channels:
- rasa_nlu
Use pip install rasa_nlu from Anaconda Prompt as mentioned in the documentation
if you are using anaconda prompt, close all your active py files and IDE and run the anaconda cmd as admin. Worked for me, if not install a c compiler
run : apt-get update && apt-get install build-essential
Then pip install rasa_core and nlu

TensorFlow 1.9.0 and Python 3.6.5

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.

install pip3 for conda

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.

Persistent issues with installation of OpenAI gym

I am running Ubuntu 16.04 and am having trouble doing a full installation of "gym". What I did:
Installed Anaconda 4.2.0 (the version that comes with Python 3.5)
Installed dependencies with sudo apt-get install -y python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libboost-all-dev libsdl2-dev swig
Cloned gym repository with "git clone https://github.com/openai/gym.git"
Installed gym with cd gym and then pip install -e '.[all]'
I get no errors throughout this process. Then I open the Spyder ide and run:
import gym
env = gym.make("CartPole-v0")
And it works fine. However, when I run
import gym
env = gym.make("LunarLander-v2")
I get the error:
/path/anaconda3/lib/python3.5/site-packages/Box2D/_Box2D.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm
I also get errors when I try to access other box2d and atari environments.
It is also worth noting that I tried doing all of this on another virtual machine on which I installed the Python 2.7 version of Anaconda, and I got the same message...so this does not seem to have anything to do with the version of python I am using.
I had the same issue on Ubuntu 16.04.
Try to install gcc (GCC) 4.8.5 in your conda environment with conda install -c anaconda gcc=4.8.5. This fixed it for me. See also https://anaconda.org/anaconda/gcc .
I had the same issue with my default gcc
$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4)
Hope that helps!
If you installed conda environment, use conda in your channel.
$ conda install -c https://conda.anaconda.org/kne pybox2d
Box2d will be added under python3.5/site-packages, and try code again.
import gym
env = gym.make("LunarLander-v2")
Good luck.

Categories

Resources