Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running pipenv shell command loads correct paths for ENVIRONMENT VARIABLES as defined in .env file except for the variable AIRFLOW_HOME #4026

Closed
10-varunshah opened this issue Nov 14, 2019 · 4 comments
Labels

Comments

@10-varunshah
Copy link

10-varunshah commented Nov 14, 2019

Issue description

I have installed the apache-airflow version 1.10.6 using pip inside the pipenv shell.

My AIRFLOW_HOME environment variable is set to ~/airflow (by default) and I want to change this path to my desired path. (to this directory containing Pipfile).
For this, I created a .env file and mentioned all environment variables and their paths that must be set each time I am inside pipenv. It successfully sets all those ENVIRONMENT VARIABLES as set in .env except the AIRFLOW_HOME variable.


For now, I have to manually run source .env to set the AIRFLOW_HOME variable to the desired path

Expected result

echo $AIRFLOW_HOME

/home/varun/Desktop/airflow

Actual result

echo $AIRFLOW_HOME

/home/varun/airflow

Here is the .env file

AIRFLOW_HOME=/home/varun/Desktop/airflow

PYTHONPATH=/home/varun/Desktop/:/home/varun/Desktop/Airflow-Start/examples/


Here is the output from pipenv --support

$ pipenv --support

Pipenv version: '2018.11.26'

Pipenv location: '/home/varun/.local/lib/python3.6/site-packages/pipenv'

Python location: '/usr/bin/python3'

Python installations found:

  • 3.6.8: /usr/bin/python3.6
  • 3.6.8: /usr/bin/python3.6m
  • 2.7.15: /home/varun/.virtualenvs/Desktop-s3uXZRW-/bin/python2.7
  • 2.7.15: /usr/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.8',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.15.0-70-generic',
 'platform_system': 'Linux',
 'platform_version': '#79-Ubuntu SMP Tue Nov 12 10:36:11 UTC 2019',
 'python_full_version': '3.6.8',
 'python_version': '3.6',
 'sys_platform': 'linux'}

System environment variables:

  • NVM_DIR
  • LS_COLORS
  • VIRTUALENVWRAPPER_WORKON_CD
  • LESSCLOSE
  • XDG_MENU_PREFIX
  • VIRTUALENVWRAPPER_HOOK_DIR
  • LANG
  • MANAGERPID
  • DISPLAY
  • INVOCATION_ID
  • WORKON_HOME
  • GNOME_SHELL_SESSION_MODE
  • COLORTERM
  • NVM_CD_FLAGS
  • GOOGLE_APPLICATION_CREDENTIALS
  • USERNAME
  • AIRFLOW_HOME
  • XDG_VTNR
  • SSH_AUTH_SOCK
  • VIRTUAL_ENV
  • XDG_SESSION_ID
  • USER
  • DESKTOP_SESSION
  • PIP_PYTHON_PATH
  • GNOME_TERMINAL_SCREEN
  • PWD
  • HOME
  • JOURNAL_STREAM
  • SSH_AGENT_PID
  • QT_ACCESSIBILITY
  • XDG_SESSION_TYPE
  • XDG_DATA_DIRS
  • NVM_IOJS_ORG_MIRROR
  • PIPENV_ACTIVE
  • XDG_SESSION_DESKTOP
  • DBUS_STARTER_ADDRESS
  • GTK_MODULES
  • WINDOWPATH
  • NVM_RC_VERSION
  • VIRTUALENVWRAPPER_SCRIPT
  • VTE_VERSION
  • SHELL
  • TERM
  • QT_IM_MODULE
  • XMODIFIERS
  • IM_CONFIG_PHASE
  • DBUS_STARTER_BUS_TYPE
  • XDG_CURRENT_DESKTOP
  • GPG_AGENT_INFO
  • GNOME_TERMINAL_SERVICE
  • NVM_NODEJS_ORG_MIRROR
  • PYTHONDONTWRITEBYTECODE
  • SHLVL
  • XDG_SEAT
  • PYTHONPATH
  • GDMSESSION
  • GNOME_DESKTOP_SESSION_ID
  • LOGNAME
  • PIP_DISABLE_PIP_VERSION_CHECK
  • DBUS_SESSION_BUS_ADDRESS
  • XDG_RUNTIME_DIR
  • XAUTHORITY
  • VIRTUALENVWRAPPER_PROJECT_FILENAME
  • XDG_CONFIG_DIRS
  • PATH
  • PS1
  • SESSION_MANAGER
  • LESSOPEN
  • _
  • PIP_SHIMS_BASE_MODULE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

  • PIPENV_ACTIVE: 1

Debug–specific environment variables:

  • PATH: /home/varun/.virtualenvs/Desktop-s3uXZRW-/bin:/home/varun/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
  • SHELL: /bin/bash
  • LANG: en_IN
  • PWD: /home/varun/Desktop/
  • VIRTUAL_ENV: /home/varun/.virtualenvs/Desktop-s3uXZRW-

Contents of Pipfile ('/home/varun/Desktop/Pipfile'):

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]

[requires]
python_version = "2.7"
@adamkgoldfarb
Copy link

Have you tried adjusting the airflow config file? I've found in the past that this file has introduced conflicts.

@10-varunshah
Copy link
Author

@adamkgoldfarb I found the issue that was not setting the AIRFLOW_HOME variable properly. I had set this environment variable to /home/varun/airflow path in ~/.bashrc file and was setting it to /home/varun/Desktop/airflow in the .env file for pipenv. So, I guess pipenv did not overwrite the set value for AIRFLOW_HOME on running pipenv shell command

Is this a pipenv bug or it does not overwrite the set values for environment variables in ~/.bashrc or ~/.profile files ?

@adamkgoldfarb
Copy link

I don't know, to be honest! I wouldn't be surprised if it respected the existing env vars, but don't know whether that's the case.

@10-varunshah
Copy link
Author

@adamkgoldfarb Is there any official documentation stating that the pipenv will respect the existing env vars and not overwrite it ? I couldn't find any of such statement made anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants