I've tried these commands inside the conda environment that I've created.
sudo pip install -U keras-tuner
sudo pip3 install -U keras-tuner
and
git clone https://github.com/keras-team/keras-tuner.git
cd keras-tuner
pip install .
Still my jupyter notebook shows an error stating:
No module named kerastuner
I just installed it with: conda install -n env_name -c conda-forge keras-tuner
To install this package with conda run one of the following:
conda install -c conda-forge keras-tuner
conda install -c conda-forge/label/cf202003 keras-tuner
source: https://anaconda.org/conda-forge/keras-tuner
If you find yourself in need of a PyPI package in Conda then you should write a YAML file and create a new environment using that. This is the best practice recommendation found in "Using Pip in a Conda Environment". Otherwise, Conda can get rather unstable if you install PyPI packages ad hoc. It would be something like:
environment.yml
name: my_keras_env
channels:
- conda-forge
- defaults
dependencies:
- python=3.7 # change this to meet your needs
- ipykernel # since you're using Jupyter
- keras
- tensorflow>=2.0.0 # this and below are keras-tuner requirements
- numpy
- tabulate
- terminaltables
- colorama
- tqdm
- requests
- psutil
- scipy
- scikit-learn
- ... # add any additional packages you require
- pip
- pip:
- keras-tuner
Note the keras-tuner requirements are found in the setup.py file.
Then, to create the environment
conda env create -f environment.yml
Note that you can use the --name|-n flag to provide a different name for the env.
Whenever you need to add additional packages to the env, edit the YAML definition and recreate the env.
Related
I need to use opencv and it needed python version older than 3.9. So I created a conda environment with python 3.7.9 and tried to use
pip install opencv-python
It installed but when I tried to import it gave an error:
ModuleNotFoundError: No module named 'cv2'
After I installed it on the anaconda environments tab I could import. I need to install pylibdmtx, too, but again I cannot import it after installing.
I see the version of python is 3.7.9 on the environment. But when I use pip it is using this:
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (0.1.9)
I do not know what I am missing here. What should I do?
Recommended Solution
Prefer specifying what you want in an environment up front, e.g.,
opencv.yaml
name: py37_opencv
channels:
- conda-forge
- defaults
dependencies:
- python=3.7
- opencv
Create Environment
conda env create -n py37_opencv -f opencv.yaml
Troubleshooting Issue
Otherwise, if you want get the version you have working, try ensuring that pip is actually installed in the environment of interest:
conda activate your_env
conda install pip
# then use pip …
I try to install yfinance into anaconda, using command:
conda install -c anaconda yfinance
error message shows:
WARNING: The conda.compat module is deprecated and will be removed in a future release.
Collecting package metadata: done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
yfinance
Current channels:
https://conda.anaconda.org/anaconda/win-64
https://conda.anaconda.org/anaconda/noarch
https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/win-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/win-64
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.
I have also used:
conda config --append channels conda-forge
nothing changes
conda install -c anaconda yfinance
conda config --append channels conda-forge
Try to use the pip install yfinance command instead of conda install
I am very first time using pyTorch. I am trying to install it. In how many ways I can do this?
Please provide the steps for that.
You can install PyTorch in 3 ways.
Using pip
Using conda
From source
1.Intel Optimized Pytorch Installation
Install the stable version (v 1.0) on Linux via Pip for Python 3.6.
pip install https://download.pytorch.org/whl/cpu/torch-1.0.1.post2-cp36-cp36m-linux_x86_64.whl
pip install torchvision
2.Conda Pytorch Installation
conda install pytorch-cpu torchvision-cpu -c pytorch
3.PyTorch Installation from source
Create a new environment:
conda create -n <env_name> python=3.6
export CMAKE_PREFIX_PATH=/home/user/.conda/envs/<env_name>
source activate <env_name>
Install dependencies:
conda install numpy pyyaml mkl mkl-include setuptools cmake cffi typing
conda install -c conda-forge opencv
conda install Pillow
Get the PyTorch source:
git clone --recursive https://github.com/intel/pytorch
cd pytorch
mv caffe2/contrib/cuda-convnet2/ /tmp
# Fix the bug removing the old package out
Install PyTorch:
python setup.py install 2>&1 | tee build.out
Hope this will help you.
Found existing installation: wrapt 1.10.11
Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Try the below commands mentioned, it worked for me
conda update wrapt
pip install tensorflow
(1) First try to install wrapt manually using following command
pip install wrapt --upgrade --ignore-installed
make sure that you use "--ignore-installed" flag when install 'wrapt' as above mentioned command
(2) Then install tensorflow with pip
eg:
pip install tensorflow==1.14
this should work
You might want to upgrade numpy with following incase its not compatible otherwise it will throw errors.
pip install numpy --upgrade
I was getting this error while installing from conda environment. Always upgrade conda or pip before a new installation.
Following worked for me:
[Optional] If installing in conda environment, then temporarily remove the conda env:
conda remove --name myenv --all
Update all conda packages:
conda update --all
Create conda env again:
conda create -n myenv
Activate conda env:
conda activate
Install tensorflow:
pip install tensorflow
I tried to install pybox2d through anaconda navigator with Python 3.7 , but it shows this error, I could not solve
I read all the library documentation!
Error:
(user) user#euser:~$ conda install -c https://conda.anaconda.org/kne pybox2d
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- jeepney
- notebook==5.7.4
- pybox2d
Use "conda info " to see the dependencies for each package.
I had the same problem. My tensorflow and pybox2d where conflicting.
I followed these steps by anuj:
conda create -n stackoverflow_env python=3.7
source activate stackoverflow_env
conda install -c kne pybox2d
and then installed tensorflow from anaconda navigator in this environment.
I created a new conda environment to avoid being influenced by the existing installations and followed the steps given below. After this, Box2D is importing fine for me.
conda create -n stackoverflow_env python=3.7
source activate stackoverflow_env
conda install -c kne pybox2d