Why conda cannot create environment with python=3.4 installed in it - python

I have miniconda 3 installation and want to create conda environment with Python 3.4. I used the command: conda create -n myenv python=3.4 and get the error:
PackagesNotFoundError: The following packages are not available from current channels:
- python=3.4
I tried to change the version to 3.7, typing conda create -n myenv python=3.7
There was no error with version 3.7. So the problem seems to be related with the older versions of python.
This is the full output with the error message:
Collecting package metadata (current_repodata.json): done
Solving environment: failed
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- python=3.4
Current channels:
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.

The reason you are not able to install python 3.4 package is that it is not available in the default channel of anaconda from where you are trying to install.
However, I just checked that it is available in the conda-forge channel. So, it can be installed as below:
conda create -n myenv python=3.4 -c conda-forge

It seems to me that Python 3.4 is not available in any of your listed repositories. I've tried to create an environment with it in Anaconda and it worked. Try to update Miniconda first:
conda update -n base -c defaults conda
If it does not work, look for a repository containing Python 3.4 and add it to your list of repositories.

what you can try is update and search python interpreter versions:
Step1:
conda update conda
Step2:
conda search "^python$"
It will list all the available versions:
python 3.4.0 0 defaults
python 3.4.1 0 defaults
python 3.4.1 1 defaults
python 3.4.1 2 defaults
python 3.4.1 3 defaults
python 3.4.1 4 defaults
python 3.4.2 0 defaults
python 3.4.3 0 defaults
python 3.4.3 2 defaults
python 3.4.4 0 defaults
python 3.4.4 5 defaults
python 3.4.5 0 defaults
Then install based on the existing versions.

You can try this if its helpful..
open Anaconda Navigator
Go to Environment tab
Click on "+Create"
Choose your preference python package, give it name and save it.
Open Anaconda prompt and type (base) C:\User\XXXX > conda info --envs
You will your environment name therein
To activate that environment type (base) C:\User\XXXX > conda activate "your env. name"
You will find your environment been activated. And now line will show like ("your env. name")C:\User\XXXX >
Enjoy !

Wanted to add that if you've already created your conda virtual environment, you can always install Python after the fact using a simple conda install python command. So no need to delete the conda env and re-create it with the python explicitly specified.

Related

Getting a series of errors when trying to update Conda and Python

I neglected to update my conda installation for a long time. It was version 4.1-ish, running Python 3.5.2. I finally decided to make the switch to Python 3.9, but I have been having some trouble getting everything to update. I started by running commands like
conda update conda
conda update anaconda
conda update python
conda update -all
repeatedly and made a fair amount of progress, but eventually conda reached a steady state and won't go any further.
Now I have conda version 4.5.11 and python 3.5.6. When I run conda update conda or conda update -n base -c defaults conda, it returns
==> WARNING: A newer version of conda exists. <==
current version: 4.5.11
latest version: 4.13.0
but then doesn't install it.
When I try conda install conda=4.13.0, I get
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- conda=4.13.0
- pymc
Use "conda info <package>" to see the dependencies for each package.
Similarly, when I try conda install python=3.9 or conda install python=3.7, it gives me
UnsatisfiableError: The following specifications were found to be in conflict:
- healpy -> python=3.5 -> libffi=3.2
- healpy -> python=3.5 -> openssl=1.0
- healpy -> python=3.5 -> readline=7
- python=3.9
UnsatisfiableError: The following specifications were found to be in conflict:
- _nb_ext_conf -> python=3.5
- python=3.7
Could I get 3.9 to work by doing conda remove pymc and conda remove healpy? Will that break anything? Is there a better way to upgrade conda/anaconda/python?
Update: I executed conda remove pymc and then tried conda install conda=4.13.0 again. Now I get
UnsatisfiableError: The following specifications were found to be in conflict:
- conda=4.13.0 -> python[version='>=3.7,<3.8.0a0'] -> openssl[version='>=1.1.1b,<1.1.2a']
- python=3.5
I recently faced the same problem.
Although it is not exactly a solution, installing a fresh new Anaconda distribution has worked for me:
Access the Anaconda's oficial website and download the Python 3.9 64-Bit installer for Linux.
Before starting the new installation, you may back up your previous environments (see this reference) and restore it later.
If you are not confident in losing your previous envs, you can make a copy of your .bashrc and .bash_profile files and choose a different installation path for the new distribution.

Anaconda/OpenCV: Installing with Tracking features

Hopefully someone can point me in the right direction here.
I'm using the latest release of Anaconda (Python 2.7). I would like to use it with OpenCV with the tracking features. I've tried various versions of the cv2.pyd file including 3.0, 3.1, 3.2, 3.3 and 3.4. However, the examples I've found use one of the following commands which are not found in the module.
tracker = cv2.Tracker_create(tracker_type)
or
tracker = cv2.TrackerKCF_create()
The usage of either of these depends which OpenCV version is being used. However, neither of them work, both with the following error.
'module' object has no attribute 'Tracker_create / or TrackerKCF_create'
All of the other features in OpenCV seem to work fine.
Is the cv2.pyd file I'm extracting from the Windows OpenCV install limited to certain features?
If I use the following in the Anaconda Prompt
conda install -c menpo opencv3
it installs the tracking features I need. However, it installs v3.1 of OpenCV which is known to have bugs with the tracking features. Ideally I wan't v3.4 of OpenCV.
Any help would be appreciated.
If you're using Anaconda then it would be wise to use it's environment management tools. Create an environment.yml file with the following contents:
environment.yml using conda-forge/opencv & python 3.6
name: opencv-env # any name for the environment
channels:
- conda-forge
dependencies: # everything under this, installed by conda
- python=3.6
- opencv=3.4
- pip: # everything under this, installed by pip
- future
environment.yml using pip/opencv-python & python 3.6
name: opencv-env # any name for the environment
channels:
- defaults
dependencies: # everything under this, installed by conda
- python=3.6
- pip: # everything under this, installed by pip
- future
- opencv-python>=3.4
How to install the environment?
conda create --force -f environment.yml
How to activate the environment?
source activate opencv-env
Once you've activated the environment, you can check the version of opencv.

Linking to python libraries from different python executables on Windows 10

I am relatively new to Python and trying to figure out how to set up my different implementations of Python. To run different packages, I have multiple installations of python 2.7 and 3.6, both 32-bit and 64-bit. For example, I run some GIS software that uses its own implementation of python (OSGEO4W) that I run from the installation location (32-bit Python 2.7). This python executable has a package (otbApplication), that doesn't really install from pip or conda. However, I mainly run python (also 32-bit Python 2.7) from Anaconda. When I am running from Anaconda, is there a way to have otbApplication and other libraries in OSGEO4W implementation of Python available?
Once you have anaconda up and running you can use following process to install anaconda equivalent of virtual environment.
Make sure you are able access anaconda from your current folder
(base) C:\Users>conda -V
conda 4.4.7
Lookup python version available to be installed.
long list, truncated here
(base) C:\Users>conda search "^python$"
Loading channels: done
Name Version Build Channel
python 2.6.8 5 defaults
|
|
|
python 3.6.4 h6538335_1 defaults
Create virtual environment with selected python version
(base) C:\Users>conda create -n testVirtualEnv python=3.6.4 anaconda
Solving environment: done
## Package Plan ##
environment location: C:\Anaconda3\envs\testVirtualEnv
added / updated specs:
- anaconda
- python=3.6.4
|
|
#
# To activate this environment, use
#
# $ conda activate testVirtualEnv
#
# To deactivate an active environment, use
#
# $ conda deactivate
Activate virtual environment
Notice context changed from (base) to (testVirtualEnv)
(base) C:\Users>conda activate testVirtualEnv
Test to check python version in virtual env.
(testVirtualEnv) C:\Users>python -V
Python 3.6.4 :: Anaconda custom (64-bit)
Install a package in virtual env
(testVirtualEnv) C:\Users>conda install -n testVirtualEnv openpyxl
Solving environment: done
## Package Plan ##
environment location: C:\Anaconda3\envs\testVirtualEnv
added / updated specs:
- openpyxl
|
|
Executing transaction: done
Deactivate running environment
Notice context changed to (base)
(testVirtualEnv) C:\Users>conda deactivate
(base) C:\Users>
Remove and delete virtual Env
(base) C:\Users>conda remove -n testVirtualEnv --all
Remove all packages in environment C:\Anaconda3\envs\testVirtualEnv
Proceed ([y]/n)? y
(base) C:\Users>
You can research further commands at official documentation site.

Conda cannot find some package (pyspark) for environment from YML

I have a .yml file that was saved by a colleague. I cannot recreate an environment with conda env create -f file.yml (both with anaconda and miniconda on Ubuntu, and with the official docker images of both)
I tried to add - conda-forge to the channels but that doesn't change anything, I still get:
Collecting pyspark==2.1.1
Could not find a version that satisfies the requirement pyspark==2.1.1 (from versions: )
No matching distribution found for pyspark==2.1.1
CondaValueError: pip returned an error.```
Whereas installing manually this package with pip or conda works.
Here are the yaml file contents:
name: stuff
channels:
- defaults
dependencies:
- pip=9.0.1=py36_1
- python=3.6.1=0
- setuptools=27.2.0=py36_0
- pip:
- pyspark==2.1.1
I think for now the guys from Continuum don't actively develop "conda env" anymore. So the recommendation is to use "conda create" directly instead. To share an environment with the exact package version you can simply export the active environment with:
conda list --explicit > my_environment.txt
and pipe the output of that to a file (in the example to "my_environment.txt"). Afterwards you can import the environment by giving it a name (in the example below "MyEnvironment") and the --file option with the exported environment:
conda create --name MyEnvironment --file my_environment.txt

The anaconda-navigator stops working after installing gdal

I am new to python and anaconda
I am using Windows 10 and Python 3.5
After installing gdal with the command (in the Anaconda prompt)
>conda install -c conda-forge gdal
the anaconda-navigator does not launch anymore and I get the error message:
pythonw: This application failed to start because it could not find or load the Qt platform plugin "windows" in "".
I think it is because some packages were downgraded... during the installation I got the message:
The following packages will be DOWNGRADED due to dependency conflicts:
anaconda-navigator: 1.3.1-py35_0 --> 1.2.3-py35_0
matplotlib: 1.5.3-np111py35_0 --> 1.5.1-np111py35_0
what is the best way to solve this problem?
I found two solutions to this problem, I think the second one is better:
Solution 1: I first solved this problem by using python 2.7 instead of 3.5.
In fact with the command:
>conda install gdal
I got the following message:
UnsatisfiableError: The following specifications were found to be in conflict:
- gdal
- python 3.5*
Use "conda info <package>" to see the dependencies for each package.
So I created a new environment with python 2.7, following the instructions here
>conda create -n py27 python=2.7 anaconda
activate py27
Then I installed the gdal (and other packages I needed)
>conda install gdal
It is then possible to directly launch the anaconda-navigator (just typing anaconda-navigator in the command line. Also opening the anaconda-navigator from the menu I can select the environment with "application on: py27" and start spyder in this environment.
Solution 2: I kept using python 3.5 but instead of using conda install I downloaded the compatible binaries from the "Unofficial Windows Binaries for Python Extension Packages"
>pip install <package-path>

Categories

Resources