I want to use the wolframclient Python package in Mathematica. The docs suggest using pip install wolframclient.
However, my main Python installation is within conda, so I do not want to use pip, but instead a standard conda install wolframclient. (The problem with using pip is that the added package's dependencies may interfere with what conda has already installed and knows about.)
The wolframclient package is at https://pypi.org/project/wolframclient/. But by default conda does not know about pypi.org. I tried the command conda config --add channels pipy, but conda install wolframclient says the channel is "not accessible or is invalid".
I think the problem is that the files at https://pypi.org/project/wolframclient/ are not already in the form of a conda package.
How might one proceed?
I think the problem is that the files at https://pypi.org/project/wolframclient/ are not already in the form of a conda package.
Yes, very precisely noted. Conda packages contain information about how to built in different format than pypi packages, which are made for pip.
In the case you describe, you ahve several options:
Create a seperate environment for wolframclient and use pip install wolframclient in there. Yes, pip and conda do not always get along, but by creating a virtual environment you have no risk of breaking other stuff and pip will be happy installing wolframclient for you
Check the wolframclient package on pypi and install the dependencies using conda before installing wolframclient with pip which might minimize the risk of having to many packages downloaded by pip
Download the source code of wolframclient and built it into a local conda package using conda build and this guide and then use conda install to install the locally built package
I have created a conda build of wolframclient (current version: 1.1.4).
Related
I accidentally install a lot of packages using pip install -r requirements.txt under base environment. Then I tried to pip uninstall, but it seems that the uninstalling process is unsuccessful.
I am using the miniconda on Windows. How can I recover the base environment to clean state? Or do I have to reinstall miniconda to remove the whole base environment?
Unlike Conda, Pip doesn't seem to track revisions and Conda doesn't actively what Pip does (it passively detects installed packages in the lib/python*/site-packages).
One idea around that conundrum might be to export a --from-history YAML:
conda env export -n base --from-history
That will include a section of pip: installed packages and you could use that as the list of packages to remove. It could still be problematic if, for example, Pip installed a newer version of a package from PyPI that is essential for the conda package to function.
If truly broken, you can also restore basic Conda functionality by using a standalone tool like Micromamba. See https://stackoverflow.com/a/75381135/570918, but you'll need to check the docs for Windows installation steps.
I started to write my own python package and want to install this in my virtual conda environment. Now, I'm a little bit confused about the possibilities to do this.
In general, during my search I found these two commands to install my package:
pip install -e <my_package>
conda-develop .
Using the first method leads to the desired result and my package is listed, if conda list has been called (although the package is still not visible in the anaconda navigator, but anyway).
In contrast to this the second method only returned "completed operation for: <path_to_my_package>", but didn't install the packe in my environment.
Does anyone know what this could be or what I am doing wrong? As far as I know, there is also the possibility to create packages directly in conda. Is there any advantage for, if it's only a private package for me?
Thank's a lot in advance.
I think here is the case. When you have a conda environment set up. The packages in the conda will be considered as global package. So, if a package is installed in your conda environment and you choose the conda interpreter in your vent environment, that package will be available. And based on your question, what you want is to be able to install a package that is only available in this vent environment. In this case, you can use terminal to go to your project path. And then use the normal pip install , in this way that package will be in the vent environment only.
Issues may arise when using pip and conda together. When combining
conda and pip, it is best to use an isolated conda environment. 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. When appropriate, conda and pip
requirements should be stored in text files.
Use pip only after conda Install as many requirements as possible with
conda then use pip.
Pip should be run with --upgrade-strategy only-if-needed (the
default).
Do not use pip with the --user argument, avoid all users installs.
And here is the official guild about using conda with pip.
I am trying to use Python to do some forecasting on 1 year wind speed, one of the method is fbprophet. After sometime browsing I found out that I need to istall it with Conda Forge.
I am completely new in this, but it seems by changing channel I need to instal some packages(panda, numpy) again using Conda forge.
One of the missing pakcage is tbats, unfortunately I could not find a way to install it with COnda-forge, only the usual pip install tbats
Is there a way I could use both tbats and fbprophet at python together?
Yes you can use both packages, conda environment can install packages using either conda install or pip install. In this case, after you install prophet just install TBATS using pip install tbats
The general recommendation is to use the same package manager (pip or conda) for all the packages. But in cases where the package is unavailable on conda, you can use pip to install the specific package alone.
Further, it is advisable to do all this within virtual envs so that even if any inconsistencies arise, it stays within the virtual env. More info on creating envs using conda can be found here.
The environment I'm in requires anaconda, but I need some PyPI packages, so I'm trying to use anaconda's conda skeleton pypi functionality to make anaconda recipes and install them automatically. However, this seems to fail whenever the PyPI package name contains a capital letter, e.g., Logbook and Represent. Is there a way to make anaconda handle this gracefully, without manually creating recipes for each offending package?
once you are in your conda environment you can use pip to install PyPi packages, using:
pip install package
you may need to conda install pip first.
So, for Represent it is pip install represent
As I understand it, if I use pip install ___, that package will go to my global version of python. If I change directory to the within my Conda environment then that package will be isolated within the environment. Is this correct?
I have searched to try and find where to put the pip packages (within my Conda environment). It used to be that you would install the pip packages in /Anaconda3/envs/venv_name/bin/. It appears the bin folder is now located within the Library folder, like this: /Anaconda3/envs/venv_name/Library/bin. Is the bin folder still the recommended place to put the packages installed by pip?
In other words should I be placing the pip installed packages here: /Anaconda3/envs/venv_name/Library/bin ?
No Specification Needed
Fortunately, one need not manually specify where to install the packages. Instead, if one uses the pip associated with the environment, packages will install to the site-packages directory of environment's python by default.
Example
> conda activate venv_name
# check that you are using the right pip
> which pip
/Anaconda3/envs/venv_name/bin/pip # should be something like this
> pip install <package name>
This will install packages into /Anaconda3/envs/venv_name/lib/python3.7/site-packages/, or whatever Python version you have installed for the environment.
⛔️ Important Note: There are some flags for pip install that change this behavior, most notably the --user flag. Conda users are strongly discouraged from using this flag because it installs packages at a user-level, leading to packages being visible to other environments with matching Python versions (major+minor).
Caution: Mixing PyPI and Conda Packages
Be aware that (as #WilliamDIrons pointed out), it is usually preferable to use conda install -n venv_name <package name> instead of pip. The common practice is to only use pip in a Conda environment when the package is not available through a Conda repository. It is strongly recommended to read and follow the best practices found in the "Using pip in an environment" documentation.