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.
Related
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've been developing my project with pip (django, drm etc). Now I need to use faiss, which only has unofficial package on pip (official - in conda). What should I do in this situation?
Can I combine them somehow? Or should I migrate to conda?
If you're using a non-conda environment, then you're limited to using pip only. That is, pip does not know how to install conda packages.
But if you switch to using conda, then you can use either. The general recommendation is to install everything with conda if possible, but use pip when you have no other choice.
I recommend installing Miniconda, then creating a new environment for all of your dependencies. If necessary, add pip-only dependencies (if you have any).
conda create --name alex python=3.8 pip django requests bla-bla-bla
conda activate alex
pip install drm foo bar yada-yada
If you need uncommon or bleeding-edge packages, you might also consider obtaining your conda packages from the conda-forge channel, rather than the defaults channel. See here for instructions.
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).
There are two pips in my environment, I use the command "conda list" to list them
pip 18.0
pip 9.0.1 py35_1
I want to remove pip 9.0.1, how can I do it?
Have you tried conda uninstall pip=*version*?
You could also run conda uninstall pip (possibly conda uninstall pip*) and remove both versions, then install the latest version of pip after that.
Two versions of pip in a single conda env should not happen through the usual update processes. Either you mistakenly installed the second, or something went very wrong with anaconda. If you suspect that it is something on anaconda's end, then this is a good opportunity for some spring cleaning. Export and then remove the environment, update and clean conda, then either:
Rebuild the environment by removing anything you don't need from your exported environment file and importing this environment again. Then run another conda update --all to ensure you are on the latest version for these packages.
OR Create a fresh environment, manually go through your exported environment and install only your most-used packages. I'd recommend this one, to get a better understanding of what dependencies your projects actually need.
Addendum:
Kota Mori comments that:
Two pip's can happen if you: 1. conda istall pip, then 2. pip install pip --upgrade.
I did not consider this in my original answer. The Conda user guide does not explicitly advise against installing packages through a non-conda version of pip: Anything installed by your pip 18.0, is in the currently active conda environment.
Pip packages do not have all the features of conda packages, and we recommend first trying to install any package with conda. [...] To gain the benefits of conda integration, be sure to install pip inside the currently active conda environment, and then install packages with that instance of pip.
However, (and this is speculation) given that Anaconda aims to simplify package management for Python and R, it may be developed for the pip version delivered by conda. Delivering v10 would then be deliberate. I would personally be wary of unintended side effects and would choose to recreate my environment if I cannot cleanly uninstall v18 and return to v10, or whichever version is currently distributed through conda.
I have installed a fresh anaconda v4.4. I realized that python packages can be installed using both conda and pip. What is the effect of using pip to install python packages instead of conda when using anaconda? Will the pip-installed libraries cease to function? I am using python v3
EDIT: I don't think the question is a duplicate of What is the difference between pip and conda?
That question explains the difference between pip and conda but does not talk about the effect of using pip when conda can be used.
Everything might keep working if you use pip to install vs conda. However, Conda cannot manage dependencies that pip has installed - it cannot upgrade them, or remove them. More importantly, conda will install a package even if its already been installed with pip! Try this test:
conda create -n testenv python=3
conda activate testenv
pip install numpy
conda install scipy
You will see from the third command that conda will want to re-install NumPy, even though it has already been installed with pip. This can cause problems if there are C libraries whose linking is different, or something like that. In general, whenever possible, use conda to install packages into conda environments.