How can I install zipline using conda with python 3.5 - python

I am on macOS Sierra 10.12.5
My end goal is to install the zipline python package and get it to run properly. However, I have hit some obstacles and since I am new to Unix and python as well, I thought maybe someone could push me in the right direction.
On the zipline website it says there is support for python 3.5. I already have python 3.6 installed via conda on my system so I decided to create an environment for the former version.
First, I did conda create -n py35 python=3.5 anaconda in the directory /anaconda/envs/py35. This installed python 3.5.3. Then, I use source activate py35 to activate it.
Next, I attempt to install zipline using a suggestion on their website with the command:
conda install -c Quantopian zipline
And I receive this error back:
Fetching package metadata ...........
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in
conflict:
- python 3.5*
- zipline -> logbook -> python 2.7*
Use "conda info <package>" to see the dependencies for each package.
I'm not sure I fully understand why python 2.7 would be in conflict if I am working from within an environment, I assumed that was the point, so nothing conflicts with other python versions. Also, it says python 3.5* does that mean it's in conflict with itself? Thanks for the help.

As discussed in comment:
pip install zipline
did you give pip install zipline a try. A lot of times conda doesn't work for me, whereas pip does.
--
#VikashSingh Yes, I am trying it now, pip did install zipline but when I attempt to run a buyaapl.py script I get an error No module named pandas.tseries.tools
I have no clue what buyaapl.py is. Please start another question and share the code as well.
PS: Probably you don't have pandas installed in the environment. Try pip install --upgrade pandas

You should run the conda install -c Quantopian zipline after you activated your conda environment.
source activate py35
Then, when you see your shell becomes (py35)$, you can run conda install -c Quantopian zipline again.
ref: http://www.zipline.io/install.html

Related

No Module named 'fastapi' - Ubuntu environment

Though I have pip and pip3 installed fastapi library in my Ubuntu based workstation, I get a weird error saying
No module named 'fastapi'.
I have been scratching my head since two days ago as the same code works in other laptop with same Ubuntu environment.
Uninstalled and reinstalled fastapi library
you're not using the correct environment to run your code.
Either, 1. install the package fast-api in the environment you running the code in or 2. switch to the other one the packages are installed in:
for 1:
sudo /bin/python3 -m pip install "fastapi[all]"
in this case you should be able to use the fast-api package
Note: the other packages you use are probably not installed as well
Maybe you are using the wrong env? It looks like you're using vscode so you can specify the interpeter
Try pip install --upgrade pip and then pip install fastapi again
Try using conda, and do conda install -c conda-forge fastapi

ModuleNotFoundError or ImportError When Installing Python Packages to Conda Env That Require Pip

While this may be pretty straightforward, I want to share a solution to an issue I was having since I did not have a problem with this until now.
Essentially I was having trouble running splinter in my conda virtual environment. I first activated my environment conda activate PythonData. Then I tried to run conda install splinter which failed, then conda install -c metaperl splinter which also failed.
I then moved onto using pip, so I went to the documentation and ran pip install splinter.
The installation said it was successful, but after restarting the kernel I was still receiving the same error.
See below the solution :)
I looked through my anaconda bins and did not find the package. Then I realized when I try to install a second time (after ensuring my environment was indeed activated), I saw it was installed in my usr folder - not my anaconda3 folder.
Therefore, I had to run pip uninstall splinter to remove it, and then did the following:
conda install pip to first install pip (which I used previously with no errors so this is puzzling, but such is life)
conda info to find my active environment path
After copying the active environment path similar to the following /anaconda/envs/venv_name, I was able to run the installation like this:
/anaconda/envs/venv_name/bin/pip install splinter
And then viola! It worked.

Installing python packages on anaconda on macos

This may be a silly simple question, but I couldn't find an answer in the documentation of Anaconda or elsewhere. I am a bit of a noob when it comes to Python and I am trying to install a package. The problem is generalizable to other packages.
specs
I am working on a macOS Catalina (10.15.5) and using Anaconda as my python environment (python2.7).
problem
I am attempting to install the package pyLDAvis in my python environment, but the package isn't available on Anaconda's environment manager, and pip or conda install isn't working on the Spyder shell. Do pip and conda installs only work on the Anaconda Prompt? The problem is that I have read that the Anaconda Prompt only exists on Windows, and I am on mac. How could I install packages (pip, conda, or else) on Anaconda?
Am I missing something?
Any help or pointers to documentation would be great! Thanks
Assuming you have conda already installed and your shell is properly configured, you can activate the base environment via
conda activate
You can also create a new environment, see manage-environments docs.
For more information than given below, see manage-pkgs docs.
In case of conda, after your environment is activated, you can then install a package via conda install <package name>, e.g. the package numpy
conda install numpy
In case of pip, after your environment is activated, you can then install a package via pip install <package name>, e.g. the package numpy
pip install numpy
I only do this if the package is not available via a conda channel.
If the package is also not available via pip, you can download the source and set the package up your self. Usually the package author describes how to set up his/her package.
Thanks Stefan for the suggestion! I struggled a bit because although conda was "already installed", my shell was indeed not "properly configured." I am writing here my solution because it may be a recurring theme for macOS users and had an easy fix.
Starting with macOS Catalina, macOS uses zsh and not bash as the default shell, and so calling conda on zsh had no effect. The error message was: -zsh: conda: command not found. I solved this by changing the default shell to bash by running the following command: chsh -s /bin/bash.
Now that the shell and conda are properly configured, I managed to use conda activate as you suggested Stefan.
Finally, the package pyLDAvis could not be installed by conda install pyldavis but was installed with pip install pyldavis.
Solved!

How to use egg to install scikit-image?

I am stuck on this installation of scikit-image (aka skimage). I tried multiple ways:
Installation from a git hub folder (using the requirements.txt)
Installation from a whl file
Installation with pip install scikit-image
All three trials failed during the import: import skimage
ImportError: cannot import name 'geometry'
It seems that scikit-image has not been built correctly.
Your install of scikit-image appears to be broken.
Try re-installing the package following the instructions at:
https://scikit-image.org/docs/stable/install.html
I went through internet but did not find solutions besides the ones above.
Does anyone went through that before?
One possibility seems to be to pip install with -egg, but I found that for Mac rather than Windows.
EDIT:
Hi everyone, so I found a solution but this is kind of very hard and I still don't understand why it did not work before.
I just:
uninstall anaconda
uninstall python
install python (3.8)
install Anaconda (I have trouble with Spyder now^^)
If you want to code for computer vision/Image processing/machine learning tasks, then it can be done in pycharm with conda environment very easily. There is no need to install python separately to run Anaconda.
First, download and install pycharm. Next, If you use windows then download Anaconda 64 bit python 3.7 version from here,
https://www.anaconda.com/distribution/#windows
You can find some details about managing environment and helpful links here,
How to create some environments for tensorflow in anaconda?
https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
Create a conda environment first using Anaconda Prompt command line,
conda create -n cvenv python=3.7
Now activate that environment using. By default base is activated.
conda activate cvenv
Next, install the packages you want,
conda install -c conda-forge scikit-learn
conda install -c conda-forge scikit-image
conda install -c conda-forge pillow
conda install -c conda-forge opencv
I use conda-forge packages as they are more recent. Finally, open pycharm and create a new project by selecting existing python interpreter in conda environment. If none exists then select,
Browse > Add Python Interpreter > Conda Environment > Interpreter > Browse > Anaconda3 installation folder > envs folder > cvenv folder > Python.exe
You can test by creating a python file and writing import skimage.

Anaconda move to Python 3

I am trying to make my Anaconda Python 2 into Python 3 on my Mac, and have been trying almost everything now. Preferably I would want to move to 3.6 but I am yet to manage to get any Python 3 version working. I started with conda install python=3.6 but got dependency errors. Then I though if I download the Anaconda installer maybe it will update everything and there will be no more dependency errors, but the installation program told me to run conda update anaconda. I still get dependency errors though. This is what I get right now:
For version 3.6:
$ conda install python=3.6
Fetching package metadata .........
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in conflict:
- argcomplete -> python 3.3* -> openssl 1.0.1*
- argcomplete -> python 3.3* -> xz 5.0.5
- python 3.6*
Use "conda info <package>" to see the dependencies for each package.
and for version 3.5:
$ conda install python=3.5
Fetching package metadata .........
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in conflict:
- backports_abc -> python 3.4*
- python 3.5*
Use "conda info <package>" to see the dependencies for each package.
What am I doing wrong and what must I do? (also, why is this so complicated?)
Update: Inspired by https://docs.continuum.io/anaconda/install I tried uninstalling like:
$ anaconda-clean -y
Backup directory: /Users/jonathan/.anaconda_backup/2017-04-24T160137
followed by the installation program again. The installation failed, anaconda is still supposed to be installed...
I know that you have uninstalled and reinstalled but you can create environments with other versions of Python.
conda create --name py36 python=3.6 anaconda
source activate py36
This would create an environment with Python 3.6 and all of the default packages in Anaconda.
You can always create different versions of python in different folders. Simply specify the python version you want to use in a NEW folder. And then activate it.
conda create -n myProject python=3
source activate myProject
I ended up removing the anaconda directory and reinstalling.

Categories

Resources