I'm new to python and Anaconda
I have python 3.8 in my (base) env, and i need pybrain, so since it's not compatible with my current version of python, i created a new env(first i tried all of it with python 3.5, didn't work, so i tried 2.7, same result):
conda create --name py27 python=2.7
then activated it:
conda activate py27
and installed pybrain there:
conda install -c mq pybrain
I checked that it has been installed successfully with:
conda list
pybrain 0.3.3 py27_0 mq
after launching jupyter notebook from same terminal, with (py27) as the 'header'?? of my command line, it opened successfully, i even checked that currently it's opened in expected environment, by typing in a cell:
!conda info
and as i expected, saw the line
active environment : py27
but also, which i guess is importnant:
python version : 3.8.3.final.0
though i am confused with ouput of:
!python --version
cause it's:
Python 2.7.18 :: Anaconda, Inc.
So when i open my notebook i type
import pybrain
and i get:
No module named 'pybrain'
Please point me in direction: what i'm doing wrong? Also it is my first virtual env(distinct from the (base) one), so i probably missing some important concepts.
Fortunately i've found a solution to use pybrain with python3 - i just downloaded it from source !pip install https://github.com/pybrain/pybrain/archive/0.3.3.zip and it works in python 3.8
Related
Steps to reproduce:
I am using Anaconda on Windows to set up environment for this repo.
conda create --name pytorch-yolo
Then I install all dependencies with conda install --file requirements.txt
Which returns
PackagesNotFoundError: The following packages are not available from current channels:
- torch[version='>=1.2']
So I install pytorch with conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
When I am trying to evaluate the model from the following repo: https://github.com/eriklindernoren/PyTorch-YOLOv3 with python3 test.py --weights_path weights/yolov3.weights inside conda environment, it returns the following error ModuleNotFoundError: No module named 'torch'
If I run a Jupyter lab or notebook, or even go with python inside conda terminal, torch is easily imported.
What I've already tried:
Almost everything from this thread: No module named "Torch"
Specifically, creating a new conda environment with python set to 3.8.2, installing torch to base and then to the environment.
I'm also using pyenv to set global python to 3.8.2, but that doesn't help at all.
conda list shows I have pytorch installed
Can't wrap my head around this issue.
You are probably using the wrong python binary. Can you try python test.py --weights_path weights/yolov3.weights?
I am not familiar with Windows terminal, but you can get the path to the binaries by using the where command (which for Linux):
(pytorch-yolo) C:\Users\RemiChauvenne>where python3
C:\Users\RemiChauvenne\AppData\Local\Microsoft\WindowsApps\python3.exe
(pytorch-yolo) C:\Users\RemiChauvenne>where python
C:\Users\RemiChauvenne\miniconda3\envs\pytorch-yolo\python.exe
C:\Users\RemiChauvenne\AppData\Local\Microsoft\WindowsApps\python.exe
We can see that python3 does not go to the python binary inside the conda environment, whereas python is correctly linked to pytorch-yolo.
It makes me crazy, In anaconda I create the environment with the defualt iterpreter python3.4 Next I install pytorch 0.4.1
conda install pytorch=0.4.1 cuda80 -c pytorch
After this I found that the pytorch was installed in python3.6!
And the environment defualt interpreter is chaged from python3.4 to python3.6.
I am very confused what happend ? How shoud I fix it back? change defualt python back to python3.4? Hope some one could help me.
The commands I typed in are as follows:
conda create -n pointgen python=3.4 ipykernel
source activate pointgen
conda install pytorch=0.4.1 cuda80 -c pytorch
Thats all. What Novak said is right, there is remaining question is how could I manually change the python version from 3.6 back to 3.4, is there any config file I can deal with?
As you can see here there is no version of pytorch for python3.4... The default version of pytorch is for python3.6 and that is the version you installed installed. In the process anaconda prompts you that it will have to upgrade/downgrade some package versions and there is probably the the line in which it says it will upgrade python to 3.6
I have installed Python version 3.5 and 3.6 and anaconda.
The following error occures when trying to install tensorflow following the steps here
https://www.tensorflow.org/install/install_windows
unsing anaconda
(tensorflow) C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
tensorflow-1.0.1-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.
As I am new to Python, I do not know how to circumvent this probelm.
I am using Win10 with 64bit.
Thanks a lot and best,
Martin
I ran into the same difficulties with the same error. It seems to be that Python 3.6 isn't immediately supported and found a sort of workaround here (note that this involves installing Python 3.5 which I did not already have installed, I don't know if this should be done a different way if its already installed):
If you are using anaconda distribution, you can do the following to use python 3.5 on the new environment "tensorflow":
conda create --name tensorflow python=3.5
activate tensorflow
conda install jupyter
conda install scipy
pip install tensorflow
\# or
\# pip install tensorflow-gpu
It is important to add python=3.5 at the end of the first line, because it will install Python 3.5.
If you've already created the tensorflow environment (the conda create step), you'll have to delete it and start over. Otherwise, you'll run into an error "CondaValueError: Value error: prefix already exists: C:\[your environment location]" (If you run into the unsupported wheel error, then you probably created the environment already.)
To delete your previous environment, according to the Conda Cheat Sheet, you first deactivate from (tensor flow) if needed by calling deactivate, then call conda remove --prefix ~/bioenvcopy --all. For ~/bioenvcopy I believe you use the tensorflow environment path. The location can be found by calling conda info --envs (citing the cheat sheet once again). Mine, for example, was conda remove --prefix ~/Anaconda3/envs/tensorflow
I successfully used this work around on Windows 10.
This solution probably be obsolete when 3.6 is supported.
Creating the tensorflow env without the correct python version did not work for me. So I had to do the following, which worked...
>deactivate tensorflow # start by deactivating the existing tensorflow env
>conda env remove -n tensorflow # remove the env
>conda create -n tensorflow python=3.5
>activate tensorflow
i had the same problem in windows 10 and python 3.6
so i navigated to anaconda navigator ( just search anaconda navigator in start search).
in the Environment tab you can create/delete your environments.
just create an environment, name it tensorflow and choose python 3.5 as python version.
then you can activate tensorflow in your command line:
activate tensorflow
and install tensorflow with :
pip install tensorflow #or tensowrlow-gpu
I had the same problem after hours of searching, I found that to save yourself from installing error problem in tensorflow. The convenient way for installing tensorflow is by creating a virtual environment in Conda with python 3.5.2 and using Conda-forge. This is done by running this commands:
conda create -n tensorflow python=3.5.2
activate tensorflow
conda config --add channels conda-forge
conda install tensorflow
Try installing the 64-bit version of Python 3.6.8:
https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe
I was getting the same error with the same OS and that's what fixed it. Apparently Tensorflow doesn't work on 32-bit Python even if your OS is 64-bit.
Try uninstalling everything (python, etc.) and try again using the cmd only, not git bash or PowerShell.
https://github.com/tensorflow/tensorflow/issues/9264
In Anaconda prompt, follow the instruction on Installing with Anaconda,
conda create -n tensorflow
activate tensorflow
Then the third step is a little different, try:
pip install tensorflow
This should work, good luck! If anything wrong happens, please let me know.
When I try to import tensorflow in IPython in my Anaconda environment, I get a No module named tensorflow error. However, when I import it after running the python command in the terminal, there are no errors.
I've googled for solutions and so far I have tried the following:
copied the site-packages inside /anaconda2/lib/python2.7/envs/tensorflow/lib/python2.7/site-packages/ to /anaconda2/lib/python2.7/site-packages/
installed ipython in the conda environment with conda install ipython
Anyone know what else I could try?
Refer: Tensorflow and Anaconda on Ubuntu?
I found a link where the tensorflow.whl files were converted to conda packages, so I went ahead and installed it using the command:
conda install -c https://conda.anaconda.org/jjhelmus tensorflow
and it worked, since the $PATH points to anaconda packages, I can import it now!
Source is here
I'm relatively new in macOS. I've just installed XCode (for c++ compiler) and Anaconda with the latest Python 3 (for myself). Now I'm wondering how to install properly second Anaconda (for work) with Python 2?
I need both versions to work with iPython and Spyder IDE. Ideal way is to have totally separate Python environments. For example, I wish I could write like conda install scikit-learn for Python 3 environment and something like conda2 install scikit-learn for Python 2.
There is no need to install Anaconda again. Conda, the package manager for Anaconda, fully supports separated environments. The easiest way to create an environment for Python 2.7 is to do
conda create -n python2 python=2.7 anaconda
This will create an environment named python2 that contains the Python 2.7 version of Anaconda. You can activate this environment with
source activate python2
This will put that environment (typically ~/anaconda/envs/python2) in front in your PATH, so that when you type python at the terminal it will load the Python from that environment.
If you don't want all of Anaconda, you can replace anaconda in the command above with whatever packages you want. You can use conda to install packages in that environment later, either by using the -n python2 flag to conda, or by activating the environment.
Edit!: Please be sure that you should have both Python installed on your computer.
Maybe my answer is late for you but I can help someone who has the same problem!
You don't have to download both Anaconda.
If you are using Spyder and Jupyter in Anaconda environmen and,
If you have already Anaconda 2 type in Terminal:
python3 -m pip install ipykernel
python3 -m ipykernel install --user
If you have already Anaconda 3 then type in terminal:
python2 -m pip install ipykernel
python2 -m ipykernel install --user
Then before use Spyder you can choose Python environment like below!
Sometimes only you can see root and your new Python environment, so root is your first anaconda environment!
Also this is Jupyter. You can choose python version like this!
I hope it will help.
This may be helpful if you have more than one python versions installed and dont know how to tell your ide's to use a specific version.
Install anaconda. Latest version can be found here
Open the navigator by typing anaconda-navigator in terminal
Open environments. Click on create and then choose your python version in that.
Now new environment will be created for your python version and you can install the IDE's(which are listed there) just by clicking install in that.
Launch the IDE in your environment so that that IDE will use the specified version for that environment.
Hope it helps!!