Trouble installing opencv3 with anaconda python 3.6 (on mac) - python-3.x

I have successfully installed anaconda with python3.6.1 on my mac. I followed the instruction from the internet:
first enter this on terminal:
conda create -n venv_demo python=3.6.1
then activate:
source activate venv_demo
However, when I tried to install openv3
I either tried the cmd line
conda install -c https://conda.anaconda.org/menpo opencv3
or
conda install -c menpo opencv3
it gave me the error as following:
error showing on terminal
Could someone tell me how to fix it? Do I need to remove python 2.7? Now I have installed python 3.6.1 and have 2 versions on my mac. Thanks!

Have a look at the list of conda installers for OpenCV in under the menpo package on Anaconda's package list:
osx-64/opencv3-3.1.0-py27_0.tar.bz2
osx-64/opencv3-3.1.0-py34_0.tar.bz2
osx-64/opencv3-3.1.0-py35_0.tar.bz2
linux-64/opencv3-3.1.0-py35_0.tar.bz2
linux-64/opencv3-3.1.0-py27_0.tar.bz2
linux-64/opencv3-3.1.0-py36_0.tar.bz2
linux-64/opencv3-3.1.0-py34_0.tar.bz2
linux-64/opencv3-3.2.0-np111py35_0.tar.bz2
linux-64/opencv3-3.2.0-np111py34_0.tar.bz2
linux-64/opencv3-3.2.0-np111py27_0.tar.bz2
win-32/opencv3-3.1.0-py27_0.tar.bz2
win-64/opencv3-3.1.0-py35_0.tar.bz2
win-32/opencv3-3.1.0-py35_0.tar.bz2
win-64/opencv3-3.1.0-py34_0.tar.bz2
win-32/opencv3-3.1.0-py34_0.tar.bz2
win-64/opencv3-3.1.0-py27_0.tar.bz2
Notice the Python versions listed in each installer. For macOS, the newest menpo installer is OpenCV 3.1.0 and works on Python 3.5. So if you want to use the menpo installer, simply create a new environment with Python 3.5, activate, and then install:
conda create -n <opencv virtual env> python=3.5
source activate <opencv virtual env>
conda install -c menpo opencv3
Otherwise if you want to use Python 3.6 (which is a really great Python release), you'll need to build from source. See the great answer from this Stack Overflow question: Can't install OpenCV3 on Anaconda3 python3.6 on macOS.

Related

Unable to install tensorflow using conda with python 3.8

Recently, I upgraded to Anaconda3 2020.07 which uses python 3.8. In past versions of anaconda, tensorflow was installed successfully. Tensorflow failed to be installed successfully in this version.
I ran the command below;
conda install tensorflow-gpu
The error message that I received is shown below;
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- tensorflow-gpu -> python[version='3.5.*|3.6.*|3.7.*|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0|>=2.7,<2.8.0a0']
Your python: python=3.8
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
The following specifications were found to be incompatible with your CUDA driver:
- feature:/win-64::__cuda==11.0=0
Your installed CUDA driver is: 11.0
Is there a conda command with the right parameters to get tensorflow installed successfully?
UPDATE:
TF is now compatible with Python 3.8
Tensorflow is not compatible with Python 3.8. See https://www.tensorflow.org/install/pip
You need to downgrade your python version :
conda install python=3.7
Create an environment with python 3.7 and then activate it:
conda create -n p37env python=3.7
conda activate p37env
And install tensorflow.
This worked for me, and found out the answer from the Anaconda user guide (under how to use a different python version: https://conda.io/projects/conda/en/latest/user-guide/getting-started.html#managing-python )
From the requirement page:
Python 3.8 support requires TensorFlow 2.2 or later.
So there is a verison of Tensorflow compatible with python 3.8.
The problem is that TensorFlow 2.2.0 is not available through conda on Windows, this should be the reason why you get PackagesNotFoundError when running
conda install tensorflow=2.2
EDIT 15/03/21
Tensorflow 2.3.0 is compatible with Windows
i think we have two options here
pip install tensorflow
or we can use another env of anaconda such as like this below
conda create -n tf tensorflow pydotplus jupyter
conda activate tf
Actually you can directly use pip inside anaconda prompt, after I tested it, I found the conda is capable with pypi, first run the anaconda prompt with administrator permission (in windows), then enter "conda update --all" to make sure all the packages are latest, finally enter "pip install tensorflow" to install (the new version of tensorflow already includes tensorflow-gpu).
Then using VS code to open an ipynb and run
import tensorflow as tf
tf.test.gpu_device_name()
everything looks good.
For more info please refer to Anaconda official docs: https://docs.anaconda.com/anaconda/ .
Latest development for tensorflow installation on anaconda.
https://anaconda.org/anaconda/tensorflow
https://anaconda.org/anaconda/tensorflow-gpu
9 days ago, Anaconda uploaded a new tensorflow v2.3 package. Anaconda3 2020.07 (uses python v3.8) users can easily upgrade to tensorflow v2.3 with the following commands;
conda install -c anaconda tensorflow
conda install -c anaconda tensorflow-gpu
I have personally tested that the installation worked successfully.
The other answers for this question have now become obsolete.
Expanding upon William's answer here with more explicit instructions and caveats. Pip is the recommended way to install latest version of tensorflow as per tensorflow's installation instructions -- "While the TensorFlow provided pip package is recommended, a community-supported Anaconda package is available."
Here is the code that uses pip to do the installation in a Conda environment:
conda create -n env_name python=3.8
conda activate env_name
conda install pandas scikit-learn matplotlib notebook ##installing usual Data Science packages that does include numpy and scipy
pip install tensorflow
python -c "import tensorflow as tf;print(tf.__version__)" ##checks tf version
In general, we should be careful while mixing two package managers (conda and pip). So, it is suggested that:
Only after conda has been used to install as many packages as possible
should pip be used to install any remaining software. If modifications
are needed to the environment, it is best to create a new environment
rather than running conda after pip.
For an example, if we would like to install seaborn in the just created env_name environment, we should:
conda create --name cloned_env --clone env_name
conda activate cloned_env
conda install seaborn
Once we check the cloned_env environment is working fine, we can delete the env_name environment.
I was running into the same issue in conda prompt for Python 3.8.5 and fixed it using a Python wheel instead. Here are the steps:
Open conda prompt and install pip if you don't have it already: python -m pip install --upgrade pip
python -m pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-2.4.0-cp38-cp38-win_amd64.whl
Note: If you need a CPU specific tensorflow, use this wheel: https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow_cpu-2.4.0-cp38-cp38-win_amd64.whl
I just downgraded python to 3.7 as tf is not avialable to 3.8 version also I cannot use virtualenv for code that's why
The only working answer for me is:
conda install -c conda-forge tensorflow
It appears that tensorflow 2.5 on GPU has issues with spyder. So, I made new environment and installed tensorflow gpu as suggested by anaconda. Now I have to use either prompt or jupyter . At least it works
For macos users I suggest create an environment with python 3.7 and install tensorflow there.
You can run these commands too:
conda create -n new_env_name python=3.7
conda activate new_env_name
I had a similar problem in Anaconda Spyder. Here was my solution (In the Anaconda Console):
conda install pip
pip install tensorflow ==2.2.0

conda_env package is not available upon downgrading Python version to 3.6

I'm trying to create a Docker image with Conda and Python 3.6 installed. I have installed Anaconda 3 with the default Python 3.7. Then I used the following command to downgrade to Python 3.6:
conda install -y python=3.6
This results in Python 3.6 successfully installing, but when I subsequently execute conda --version, it gives me the error
'conda' module not found
I found that under python3.6/site-packages folder there are no Conda-related packages and instead all these packages are found under python3.7/site-packages.
It used to work before. Is there a way to get conda packaged under python3.6 folder?
Srikanth,
You should always try creating a new environment when you are working with some old version of any library.
conda create -n myenv python=3.4
If you want to install specific packages in this environment, you can use
conda install -n myenv tensorflow
Refer to this documentation for more information:
docs.conda.io

can't install flashtext python library on windows anaconda

I am running Python on anaconda windows.
I need to use flashtext library and seems it's not possible if you run python on windows.
Is there any solution ?
Using Windows 10 and Anaconda 2018.12 - Python 3.7, I ran the following in Anaconda prompt:
(base) C:\Users\john.doe>pip install flashtext
And it returned
Successfully installed flashtext-2.7
Testing revealed it works properly, however there are some caveats when mixing pip and conda.. please heed them.
Anaconda support FlashText library.
conda install -c derickl flashtext

how to install pytorch version 0.1.12 in anaconda 3.6 windows 10?

Tried to install with this command but still didn't work-> conda install -c peterjc123 pytorch=0.1.12
Also tried installing using this command:
conda install pytorch=0.1.12 -c pytorch
How can it be installed with python anaconda 3.6?
First of all, make sure that Python 3.5 or later is installed as well.
Go to this link and download "pytorch-0.1.12-py36_0.1.12cu80.tar.bz2".
Now navigate to the downloaded file and install it through Anaconda console conda install [path to file]/pytorch-0.1.12-py36_0.1.12cu80.tar.bz2
Note:
If it requires some additional modules, use conda or pip to install those addition modules via:
conda install (module)
or
pip install (module)

Installing Anaconda on Ubuntu 14.04 - installing mrjob

The installation went fine, except for the last three packages:
mrjob, pattern, and seaborn
I was able to install these from a terminal, however they installed into my old Python environment and not into the anaconda environment. How can I install these packages into my anaconda environment?
Those packages are not available in Anaconda. So you need to use the pip command to install them. The package will be installed in your active conda environment.
pip install mrjob
Use conda to install them. For mrjob and pattern, you may need find them on Binstar. It looks like conda install -c chdoig -c nbsantos mrjob pattern seaborn should work.
If you installed Python environment uses Anaconda, then you should do this command
conda install -c conda-forge -n [your-env-name] mrjob.
It would take mrjob packages from conda-forge repository.

Resources