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

Pipenv doesn't install Jinja2 MarkupSafe dependency when using--two #2866

Closed
al4 opened this issue Sep 19, 2018 · 4 comments
Closed

Pipenv doesn't install Jinja2 MarkupSafe dependency when using--two #2866

al4 opened this issue Sep 19, 2018 · 4 comments

Comments

@al4
Copy link

al4 commented Sep 19, 2018

Issue description

When installing jinja2 under Python 2.7.15, the MarkupSafe dependency is omitted from Pipefile.lock.

Expected result

Pipenv adds markupsafe to Pipfile.lock

Actual result

The dependency is not recorded in Pipfile.lock. Note that the dependency is installed in the original venv, it's just not recorded in the lock, so if I remove and recreate the environment Jinja2 is unusable.

If I use --three to install under Python 3.7, the dependency is recorded in Pipfile.lock as expected.

Steps to replicate

In an empty dir:

$ pipenv --two install jinja2
[...]
Collecting MarkupSafe>=0.23 (from jinja2)
Installing collected packages: MarkupSafe, jinja2
Successfully installed MarkupSafe-1.0 jinja2-2.10

Adding jinja2 to Pipfile's [packages]...
Pipfile.lock not found, creating...
[...]
$ pipenv run pip freeze
Jinja2==2.10
MarkupSafe==1.0
$ pipenv --rm
$ pipenv install
$ pipenv run python -c 'import jinja2'
Traceback (most recent call last):
[...]
ImportError: No module named markupsafe
$ pipenv run pip freeze
Jinja2==2.10

In Pipfile.lock, markupsafe is missing.

If I repeat the process with --three instead of --two, markupsafe is added to Pipfile.lock as expected.

The dependency declaration looks standard, I can't see any reason why it should be treated differently under Python 2: https://github.com/pallets/jinja/blob/7a6704db55fcd9bbe5a90c3868e03f5a5fcf176a/setup.py#L74


$ pipenv --support

Pipenv version: '2018.7.1'

Pipenv location: '/usr/local/Cellar/pipenv/2018.7.1/libexec/lib/python3.7/site-packages/pipenv'

Python location: '/usr/local/Cellar/pipenv/2018.7.1/libexec/bin/python3.7'

Other Python installations in PATH:

  • 2.7: /usr/local/bin/python2.7

  • 2.7: /usr/local/bin/python2.7

  • 2.7: /usr/bin/python2.7

  • 3.7: /usr/local/bin/python3.7m

  • 3.7: /usr/local/bin/python3.7

  • 2.7.15: /usr/local/bin/python

  • 2.7.10: /usr/bin/python

  • 2.7.15: /usr/local/bin/python2

  • 3.7.0: /usr/local/bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.0',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '17.6.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 17.6.0: Tue May  8 15:22:16 PDT '
                     '2018; root:xnu-4570.61.1~1/RELEASE_X86_64',
 'python_full_version': '3.7.0',
 'python_version': '3.7',
 'sys_platform': 'darwin'}

System environment variables:

  • PATH
  • TERM
  • SHELL
  • HISTSIZE
  • TMPDIR
  • USER
  • PAGER
  • PWD
  • DEFAULT_USER
  • EDITOR
  • LANG
  • ITERM_PROFILE
  • HOME
  • LESS
  • LOGNAME
  • VISUAL
  • HISTFILE
  • PYTHONDONTWRITEBYTECODE
  • PIP_PYTHON_PATH

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /usr/local/Cellar/pipenv/2018.7.1/libexec/tools:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/al4/.rvm/bin:/Users/al4/Library/Python/3.7/bin
  • SHELL: /bin/zsh
  • EDITOR: nano
  • LANG: en_GB.UTF-8
  • PWD: /Users/al4/pipenv-test

Contents of Pipfile ('/Users/al4/pipenv-test/Pipfile'):

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

[packages]
"jinja2" = "*"

[dev-packages]

[requires]
python_version = "2.7"

Contents of Pipfile.lock ('/Users/al4/pipenv-test/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "91961d0089bcab0e254ee9ac6b011d3b25d4c70696c7a78483f2d17c289006f6"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "2.7"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "jinja2": {
            "hashes": [
                "sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd",
                "sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"
            ],
            "index": "pypi",
            "version": "==2.10"
        }
    },
    "develop": {}
}
@al4
Copy link
Author

al4 commented Sep 19, 2018

Seems to be skipping it in the locking phase:

pipenv --two install -v jinja2

Locking [packages] dependencies...
using sources: [{u'url': u'https://pypi.org/simple', u'verify_ssl': True, u'name': u'pypi'}]
Using pip: -i https://pypi.org/simple

                          ROUND 1
Current constraints:
  jinja2 (from -r /var/folders/8k/q9zn2z3x55v7936qrf7cp30w0000gp/T/pipenv-btD80I-requirements/pipenv-0BgzIb-constraints.txt (line 2))

Finding the best candidates:
  found candidate jinja2==2.10 (constraint was <any>)

Finding secondary dependencies:
  jinja2==2.10              requires jinja2==2.10

New dependencies found in this round:
  adding [u'jinja2', '==2.10', '[]']
Removed dependencies in this round:
Unsafe dependencies in this round:
------------------------------------------------------------
Result of round 1: not stable

                          ROUND 2
Current constraints:
  jinja2==2.10 (from -r /var/folders/8k/q9zn2z3x55v7936qrf7cp30w0000gp/T/pipenv-btD80I-requirements/pipenv-0BgzIb-constraints.txt (line 2))

Finding the best candidates:
  found candidate jinja2==2.10 (constraint was ==2.10)

Finding secondary dependencies:
  jinja2==2.10              requires jinja2==2.10
------------------------------------------------------------
Result of round 2: stable, done

Updated Pipfile.lock (9006f6)!

pipenv --three install -v jinja2

Locking [packages] dependencies...
using sources: [{'url': 'https://pypi.org/simple', 'verify_ssl': True, 'name': 'pypi'}]
Using pip: -i https://pypi.org/simple

                          ROUND 1
Current constraints:
  jinja2 (from -r /var/folders/8k/q9zn2z3x55v7936qrf7cp30w0000gp/T/pipenv-x8uiqo20-requirements/pipenv-4tpg7i6e-constraints.txt (line 2))

Finding the best candidates:
  found candidate jinja2==2.10 (constraint was <any>)

Finding secondary dependencies:
  jinja2==2.10              requires jinja2==2.10, markupsafe>=0.23

New dependencies found in this round:
  adding ['jinja2', '==2.10', '[]']
  adding ['markupsafe', '>=0.23', '[]']
Removed dependencies in this round:
Unsafe dependencies in this round:
------------------------------------------------------------
Result of round 1: not stable

                          ROUND 2
Current constraints:
  jinja2==2.10 (from -r /var/folders/8k/q9zn2z3x55v7936qrf7cp30w0000gp/T/pipenv-x8uiqo20-requirements/pipenv-4tpg7i6e-constraints.txt (line 2))
  markupsafe>=0.23

Finding the best candidates:
  found candidate jinja2==2.10 (constraint was ==2.10)
  found candidate markupsafe==1.0 (constraint was >=0.23)

Finding secondary dependencies:
  markupsafe==1.0           requires markupsafe==1.0
  jinja2==2.10              requires jinja2==2.10, markupsafe>=0.23

New dependencies found in this round:
  adding ['markupsafe', '==1.0,>=0.23', '[]']
Removed dependencies in this round:
  removing ['markupsafe', '>=0.23', '[]']
Unsafe dependencies in this round:
------------------------------------------------------------
Result of round 2: not stable

                          ROUND 3
Current constraints:
  jinja2==2.10 (from -r /var/folders/8k/q9zn2z3x55v7936qrf7cp30w0000gp/T/pipenv-x8uiqo20-requirements/pipenv-4tpg7i6e-constraints.txt (line 2))
  markupsafe==1.0,>=0.23

Finding the best candidates:
  found candidate jinja2==2.10 (constraint was ==2.10)
  found candidate markupsafe==1.0 (constraint was >=0.23,==1.0)

Finding secondary dependencies:
  jinja2==2.10              requires jinja2==2.10, markupsafe>=0.23
  markupsafe==1.0           requires markupsafe==1.0
------------------------------------------------------------
Result of round 3: stable, done

Updated Pipfile.lock (fb0c47)!

@al4
Copy link
Author

al4 commented Sep 19, 2018

🤦🏻‍♂️

Fixed this myself with pipenv lock --clear

Appears there was a bad result in the cache.

@Ravi8860
Copy link

Ravi8860 commented Jun 2, 2020

Requirement already satisfied: MarkupSafe>=0.23 in c:\users\ravi\appdata\local\programs\python\python38\lib\site-packages (from Jinja2>=2.10.1->flask) (1.1.1)

@techalchemy
Copy link
Member

@Ravi8860 there is an active regression in the most recent release, please refer to #4276 (fixed by #4284)

a fix will be pushed shortly -- note that this is a completely unrelated thread and should not be used for any new issues with pipenv. Thanks!

@pypa pypa locked as resolved and limited conversation to collaborators Jun 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants