0

I have installed python 3.5 and 2.7 as project interpreters. Whenever I install Zipline, it says that it is installed successfully, but I cant find it in the packages nor if I type in my python file 'import zipline...'

cem
  • 13
  • 3
  • 1
    How did you install Zipline? Which Python interpreter is being used to run your file? – zachdj Jul 22 '19 at 13:33
  • @zachdj I first downloaded python 3.5 and then created a new project interpreter, then I opened my project, then went to preferrences and clicked on the '+' botton and searched for Zipline, it was available. Went I installed it, it says it was suucessfull, but then I cant fin it back. I have screenshots but I dont know how to upload them – cem Jul 22 '19 at 14:01

1 Answers1

1

To answer this question, it would be beneficial if you state how you installed Zipline and which Python interpreter is being used for the project. Something else that could play a role in this is whether or not you are using a virtual environment, this can be checked by clicking terminal, then if it says (venv) before the line.

Update #1

@cem When you create a project in Pycharm, it creates a virtual environment for that project. You can see if this is true by clicking "Terminal in the bottom left corner. The bottom line should look something like this:(venv) C:\Users\griff\PycharmProjects\untitled> Notice the (venv).

To find out what Python interpreter you are using for this project in Pycharm, open the terminal in Pycharm again. and type python --version this will output what Python interpreter is being used.

The way you should be installing packages in Pycharm is:

1) Click the terminal again

2) type pip install zipline

This will install the package on your venv for Pycharm and you should be able to import them.

Update #2

@cem The problem I believe, is that you are installing the library with a Python interpreter that you are not using on your Pycharm project. One way to solve this is with a virtual environment. It is a good habit for Python developers to create virtual environments for their projects, and avoid global install of libraries. So, it seems as though you are not using a virtual environment. To start a virtual environment in Pycharm follow this guide: https://www.jetbrains.com/help/pycharm-edu/creating-virtual-environment.html

Then follow the steps to install the package again as I pointed out in Update 1.

UPDATE #3

so this is not the best practices solution but at this point we just need to fix this. Open up your terminal and type python --version . take note of the version. then type either python3 pip install zipline or just pip install zipline whichever one works. After that open up Pycharm and make sure the Python interpreter you are using for that project is the same as the version that was returned when you typed python --version into terminal

griffin_cosgrove
  • 371
  • 5
  • 14
  • @griffin_cosgrive i did it like this: I first downloaded python 3.5 and then created a new project interpreter, then I opened my project, then went to preferrences and clicked on the '+' botton and searched for Zipline, it was available. Went I installed it, it says it was suucessfull, but then I cant fin it back. I have screenshots but I dont know how to upload them... regarding your last sentence, I dont know how to check that on terminal – cem Jul 22 '19 at 14:02
  • Sorry for coming back to you so late. I am currently travelling (in the trein - luckily with wifi), I did as you suggested, it says that I have python 3.6.6. Moreover, I did step 2 and everything seemed to fine untill this error showed up: ''Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/anaconda3/lib/python3.6/site-packages/pandas-0.24.2.dist-info/AUTHORS.md' Consider using the `--user` option or check the permissions.'' So what now? – cem Jul 22 '19 at 15:04
  • @cem looks like you are not using the 3.5 Python you downloaded but instead an Anaconda distro. there are 3 solutions to the problem: https://github.com/googlesamples/assistant-sdk-python/issues/236 – griffin_cosgrove Jul 22 '19 at 17:32
  • What does an anaconda distro imply? Does removing it, make my life easier? Also I follow the website (thanks for that :) ). I managed to install python 3.5. But when I tried, i get: Could not find a version that satisfies the requirement zipline (from versions: ) No matching distribution found for zipline – cem Jul 22 '19 at 17:49
  • see my latest comment – cem Jul 22 '19 at 18:14
  • @cem Anaconda is a distribution of Python popular among data scientists because it includes many popular data analytic libraries with the installation, such as pandas and numpy. Also includes Jupyter Notebooks. – griffin_cosgrove Jul 23 '19 at 00:35
  • I see. Thanks for the info. However,I would like to come back to my original problem. The solution that you provided doesnt seem to work. See my previous comment. (maybe your solution works but there is something that I overlooked) – cem Jul 23 '19 at 09:28
  • @cem Ok. What OS are you on? – griffin_cosgrove Jul 25 '19 at 14:05
  • im on OS 10.14.5 – cem Jul 26 '19 at 10:45
  • Ill check everything out when im back, like i said before im travelling. But you are right, i did manage to install venv and installed zipline, when i change the environment i want to install python 3.5 but doesnt work. But I will get back to you, I cant think of the whole process right now. Again thanks griffin. Btw is it possible for PMs in stackover flow? – cem Jul 29 '19 at 09:16
  • I tried your steps and updates but it doesnt work, i tried using pip and pip3, but i get ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. – cem Sep 13 '19 at 20:31
  • You need to add the package containing the executable _config. Answer here: https://stackoverflow.com/questions/11618898/pg-config-executable-not-found – griffin_cosgrove Sep 16 '19 at 15:32
  • So I though I would provide an update on how things are. And maybe for those who are interested or get the same problem. I am able to run zipline locally, and created my own backtests and run able to run multiple backtests and ingested my own data. I would advise using the Conda method, install it. Create your own environment with the necessary python interpreter and use that env for your IDE, and you are good to go. – cem Nov 14 '19 at 23:13