简体   繁体   English

在Conda环境中安装Apache-Airflow

[英]Installing Apache-Airflow in Conda Environment

The Situation 情况

I am trying to install apache-airflow using pip into a conda environment. 我正在尝试使用pip将apache- airflow安装到conda环境中。 I am not able to, since setup.py egg_info keeps failing: 我无法,因为setup.py egg_info一直失败:

Command "python setup.py egg_info" failed with error code 1 in C:\\Users\\joshu\\AppData\\Local\\Temp\\pip-install-3efyslfh\\apache-airflow\\ 命令“python setup.py egg_info”失败,错误代码1在C:\\ Users \\ joshu \\ AppData \\ Local \\ Temp \\ pip-install-3efyslfh \\ apache-airflow \\

message when I run 我跑的时候留言

pip install "apache-airflow[s3, postgres]"

I ran this in Windows cmd, then did all the steps again as admin in cmd (shift+enter when opening cmd). 我在Windows cmd中运行它,然后在cmd中再次执行所有步骤(在打开cmd时shift + enter)。

(myVenv) C:\Users\joshu\Documents>pip install "apache-airflow[s3, postgres]"
Collecting apache-airflow[postgres,s3]
  Using cached https://files.pythonhosted.org/packages/9e/12/6c70f9ef852b3061a3a6c9af03bd9dcdcaecb7d75c8898f82e3a54ad5f87/apache-airflow-1.9.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\joshu\AppData\Local\Temp\pip-install-3efyslfh\apache-airflow\setup.py", line 102
        async = [
              ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\joshu\AppData\Local\Temp\pip-install-3efyslfh\apache-airflow\

Steps I took 我采取的步骤

1) I first created a conda environment and installed pip and setuptools into the environment: 1)我首先创建了一个conda环境,并将pip和setuptools安装到环境中:

C:\Users\joshu\Documents>conda create -n airflow pip setuptools
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.5.4
  latest version: 4.5.10

Please update conda by running

    $ conda update -n base conda



## Package Plan ##

  environment location: C:\Users\joshu\Anaconda3\envs\airflow

  added / updated specs:
    - pip
    - setuptools


The following NEW packages will be INSTALLED:

    certifi:        2018.8.13-py37_0
    pip:            10.0.1-py37_0
    python:         3.7.0-hea74fb7_0
    setuptools:     40.0.0-py37_0
    vc:             14.1-h0510ff6_3
    vs2015_runtime: 15.5.2-3
    wheel:          0.31.1-py37_0
    wincertstore:   0.2-py37_0

C:\Users\joshu\Documents>activate airflow

(airflow) C:\Users\joshu\Documents> pip freeze
certifi==2018.8.13
wincertstore==0.2

(airflow) C:\Users\joshu\Documents>conda list
# packages in environment at C:\Users\joshu\Anaconda3\envs\airflow:
#
# Name                    Version                   Build  Channel
certifi                   2018.8.13                py37_0
pip                       10.0.1                   py37_0
python                    3.7.0                hea74fb7_0
setuptools                40.0.0                   py37_0
vc                        14.1                 h0510ff6_3
vs2015_runtime            15.5.2                        3
wheel                     0.31.1                   py37_0
wincertstore              0.2                      py37_0

(airflow) C:\Users\joshu\Documents>where pip
C:\Users\joshu\Anaconda3\envs\airflow\Scripts\pip.exe
C:\Users\joshu\Anaconda3\Scripts\pip.exe

(airflow) C:\Users\joshu\Documents>which pip
/c/Users/joshu/Anaconda3/envs/airflow/Scripts/pip

After this setup, running pip install apache-airflow gives me the error at the top of this page 完成此设置后,运行pip install apache-airflow会在本页顶部给出错误

Other steps I took 我采取的其他步骤

  1. Installing apache-airflow on my system (no conda environment). 在我的系统上安装apache-airflow(没有conda环境)。 This works, but I'm looking to have it contained in an environment. 这有效,但我希望它包含在一个环境中。
  2. Upgrading setuptools: 升级setuptools:
code: 码:
(airflow) C:\Users\joshu\Documents>python -m pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
Successfully installed pip-18.0

(airflow) C:\Users\joshu\Documents>which pip
/c/Users/joshu/Anaconda3/envs/airflow/Scripts/pip

(airflow) C:\Users\joshu\Documents>pip --version
pip 18.0 from c:\users\joshu\anaconda3\envs\airflow\lib\site-packages\pip (python 3.7)

(airflow) C:\Users\joshu\Documents>pip install "apache-airflow[s3, postgres]"

I've also tried upgrading pip then running install -- no luck 我也试过升级pip然后运行安装 - 没有运气

 (airflow) C:\\Users\\joshu\\Documents>python -m pip install --upgrade pip Collecting pip Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl Installing collected packages: pip Found existing installation: pip 10.0.1 Uninstalling pip-10.0.1: Successfully uninstalled pip-10.0.1 Successfully installed pip-18.0 (airflow) C:\\Users\\joshu\\Documents>which pip /c/Users/joshu/Anaconda3/envs/airflow/Scripts/pip (airflow) C:\\Users\\joshu\\Documents>pip --version pip 18.0 from c:\\users\\joshu\\anaconda3\\envs\\airflow\\lib\\site-packages\\pip (python 3.7) (airflow) C:\\Users\\joshu\\Documents>pip install "apache-airflow[s3, postgres]" 

Ultimately I would like to have airflow and related packages I need for my project in a conda environment. 最后,我想在conda环境中为我的项目提供所需的气流和相关包。

The error appears to be because async is a reserved keyword in Python 3.7 and this package has not updated their setup.py script. 该错误似乎是因为async是Python 3.7中的保留关键字,并且此软件包尚未更新其setup.py脚本。 You can use Python 3.6 until the package is updated 您可以使用Python 3.6直到更新包

conda create -n airflow pip setuptools python=3.6
conda activate airflow
pip install "apache-airflow[s3, postgres]"

I also had the same problem. 我也有同样的问题。 I solved it by installing with conda instead of pip: 我通过使用conda而不是pip来解决它:

conda install -c conda-forge airflow conda install -c conda-forge airflow

https://anaconda.org/conda-forge/airflow https://anaconda.org/conda-forge/airflow

I ran into the same problems. 我遇到了同样的问题。 Apache Airflow 1.10 is incompatible. Apache Airflow 1.10不兼容。

My solution was to build the source code. 我的解决方案是构建源代码。 I got the latest source code via git. 我通过git获得了最新的源代码。 This command creates a wheel file in the dist directory. 此命令在dist目录中创建一个wheel文件。

python3 setup.py bdist_wheel

Then you install 然后你安装

pip3 install apache_airflow-2.0.0.dev0+incubating-py3-none-any.whl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM