I use homebrew to install packages on my Mac OS High Sierra. However, I encountered a package called spdlib that is not available through homebrew. The package is available as an install through conda using the following (source):
conda install -c rios -c conda-forge spdlib
What is the preferred method of getting spdlib on my machine taking into account I do not want homebrew and conda to confict?
One way would be to install Miniconda.
Create a new environment:
conda create -n myenv python=3.6
activate it:
source activate myenv
with a new conda this should work too:
conda activate myenv
Now, you can install what you need without interfering with your homebrew packages:
(myenv) conda install -c rios -c conda-forge spdlib
Related
i have dask, dask-core and dask geopandas installed as shown:
dask 2021.7.1 pyhd8ed1ab_0 conda-forge
dask-core 2021.7.1 pyhd8ed1ab_0 conda-forge
dask-geopandas 0.1.0a4 pypi_0 pypi
however, when importing I kept getting an error message :
"ModuleNotFoundError: No module named 'dask_geopandas'"
I wonder what has gone wrong with installation, thank you.
This could happen if pip install and conda install installed packages in different paths (this typically happens when the conda environment does not have its own pip).
A simple way out of this is to install everything with conda, so in this case you would run the following within your conda environment:
conda install -c conda-forge dask dask-geopandas
Alternatively, make sure that your conda environment has pip installed also and then run the pip within the conda environment:
conda install -c conda-forge dask pip
# if the conda environment is not activate, then activate it
# using: conda activate the_name_of_your_env
pip install dask-geopandas
In addition, there are specific instructions at https://geopandas.readthedocs.io/en/latest/getting_started/install.html#installing-with-pip about extra steps you may need to take when using pip - you might need a compiler available in your system.
I have used anaconda and miniconda without problem before so I don't know why I am having doubts now about the order to use them as
create an environment with conda create
Activate the environment with conda activate
Install packages with conda install
However, lately I have read one set of instructions in which they do a different order: 1->3->2. That means installing without activating and then activating.
Is this correct? Aren't I installing libraries outside of the environment?
There are multiple ways to create and install packages using conda.
create an environment, activate, install packages
conda create --name env_name python=3.8
conda activate env_name
conda install package_name another_package
create an environment with packages
conda create -n env_name python=3.8 package_name another_package
conda activate env_name
Both methods are correct. In fact, we often use a mix here and there. For example, if I have a project with requirements.txt to be installed with pip but would like it to have pandas and scikit-learn from conda-forge. I will do:
conda create --name ml_api python=3.7 -c conda-forge scikit-learn pandas
conda activate ml_api
python -m pip install -r requirements.txt
At any point, we can add packages in conda environment with
# this will install requests to ml_api env. This can be done at any (env)
conda install --name ml_api requests
# or activate ml_api and install. This will install on activated env
conda activate ml_api
conda install requests
At the end of the day, conda is there to help you. A better flow will depend on your need.
The order you listed them is correct but you only need the conda install packagename before you run the code. So you should first create the conda environment and then activate it. Now when you get ready to run the code the first time, be sure to install your package. This enables you to import the package in your python code.
I cant seem to install the right version of torch and I cant get fast ai libraries working
I try
Python 3.7
pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision
Could not find a version that satisfies the requirement torch>=1.1.0 (from torchvision) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
No matching distribution found for torch>=1.1.0 (from torchvision)
I feel like I may of downgraded my gpu when I tried conda install fast ai
and then I tried pip and it couldnt find a file C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\caffe2\python\serialized_test\data\operator_test
I finally got to the point where it said successfully installed six, pillow, and torch but torch is at 0.3 which is incompatiable.
pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision
expected to install pytorch or fastai nothing seems to work
You may try installing the course by creating a conda environment provided anaconda is already installed in your windows machine.
conda update conda
conda create -n fastai_conda python=3.6
conda activate fastai_conda
conda install fastai pytorch=1.0.0 -c fastai -c pytorch -c conda-forge
Or for installing CPU version you can use the below commands after the environment is created
conda install -c pytorch pytorch-cpu torchvision
conda install -c fastai fastai
You can check if installation went right with this command
python -m fastai.utils.show_install
You may further need to install ipykernel to use the conda environment in your jupyter notebook.For that activate environment and run the following commands:
conda install nb_conda_kernels
python -m ipykernel install --user --name fastai_v1 --display-name "fastai v1"
conda install ipywidgets
We can install tensorflow-transform using pip but how do I install it using Conda?
I have tried using conda install -c anaconda tensorflow-transform and all its variants without result.
A search of Anaconda Cloud shows that tensorflow-transform is not available through any channels on any platform. Moreover, the recommended way to install the package is to use PyPI. However, one can still install the package into a specific Conda env by first activating the env:
conda activate your_env
pip install tensorflow-transform
How can I add a package to an existing conda environment?
If it is a python package I can use pip install <package>, but what if pip does not work?
Is it sufficient to activate the environment and use conda install <package>?
You've answered your own question. In fact you really want to do conda install ... instead of using pip if you can.
You can install a conda package also without activating the environment. Just use conda install -n <env_name> <package> or conda install -p <path/to/env> <package>.
If you want to install a specific package inside a specific conda environment, you can use the following command.
First activate the conda environment and then do:
$ conda install --name <conda_env_name> -c <channel_name> <package_name>
For a concrete example, let's assume that you want to install chainer from the channel anaconda to an already created conda environment named chainerenv, then you can do:
$ conda install --name chainerenv -c anaconda chainer
If you want to install a package in the environment, you can use
conda install -p /path/to/env package
example:
conda install -p /users/dekstop/env-test Django
There's an alternative way to do this and I have just tested it on my own mac:
example: i want to install a non-conda package at my python2.7 environment:
go to terminal
activate the desired environment by: source activate py27
after you successfully activated the environment, you can install the package you wanted by: pip install package
The answer is yes (usually).
One example is that you can activate your conda environment and then directly do conda install pandas.tar.bz2 on the existing tar.bz2 files from /conda_envs/.pkgs (leftovers from other environments)
If you don't have a tarball package like that but you have the src with setup.py you can just do the usual install by python setup.py install (or python setup.py develop to link the src)