Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install airflow package extras in PyCharm

Tags:

I want to use Airflow package extras s3 and postgres in PyCharm but do not know how to install them (on macOS Sierra).

My attempts so far

Airflow itself can be installed from Preferences > Project > Project interpreter > + but not the extras as far as I can work out. The extras can be installed with pip in the terminal using

$ pip install airflow[s3,postgres]

but they end up in a different interpreter (~/anaconda) than the one used by PyCharm (/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7).

Checking the Python executables in my /usr/local/bin directory I found that only pip3 and pip3.5 point to the PyCharm interpreter, but pip, pip2, pip2.7 do not.

$ ls -la /usr/local/bin | grep pip
-rwxr-xr-x    1 root        admin       204 Dec 21 11:41 pip
-rwxr-xr-x    1 root        admin       204 Dec 21 11:41 pip2
-rwxr-xr-x    1 root        admin       204 Dec 21 11:41 pip2.7
lrwxr-xr-x    1 christofer  admin        34 Nov 21 11:53 pip3 -> ../Cellar/python3/3.5.2_3/bin/pip3
lrwxr-xr-x    1 christofer  admin        36 Nov 21 11:53 pip3.5 -> ../Cellar/python3/3.5.2_3/bin/pip3.5

Browsing the directory of the PyCharm interpreter I found all the expected python executables (python, python2.7 etc.) pointed to from /usr/local/bin but no pip.

What I need help with

So, the problem could be solved if I/you/we can figure out either

  1. how to install airflow[s3,postgres] from within PyCharm, or
  2. how to run pip install airflow[s3,postgres] pointing to the PyCharm interpreter.
like image 699
Backlin Avatar asked Feb 01 '17 14:02

Backlin


1 Answers

So, the problem could be solved if I/you/we can figure out either

  1. how to install airflow[s3,postgres] from within PyCharm, or

  2. how to run pip install airflow[s3,postgres] pointing to the PyCharm interpreter.

Or maybe?:

  1. Add the ~/anaconda Python to Pycharm

To add another python interpreter to Pycharm goto:

File -> Settings -> Project: -> Project Interpreter

Press the Gear Button and select more:

enter image description here

This shows all of the interpreters configured. Select the + button, and select add local:

enter image description here

Now you should be able to add your anaconda Python to Pycharm. You can then select which Python to use as primary for the project, and you can select which Python to run under:

Run -> Edit Configurations
like image 68
Stephen Rauch Avatar answered Oct 11 '22 17:10

Stephen Rauch