question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SyntaxError: invalid from typing import TYPE_CHECKING

See original GitHub issue

Virtual env was created and I edited the pipfile.lock once before creating the env Is this a bug or problem with my environment???

Pinning VCS Packages...Branch mil set up to track remote branch mil from origin.
Switched to a new branch 'mil'
✘ Locking Failed! 
Traceback (most recent call last):
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 126, in <module>
    main()
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 119, in main
    parsed.requirements_dir, parsed.packages)
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 85, in _main
    requirements_dir=requirements_dir,
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 69, in resolve
    req_dir=requirements_dir
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/utils.py", line 700, in resolve_deps
    from .vendor.requirementslib.models.requirements import Requirement
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/__init__.py", line 14, in <module>
    from .models.pipfile import Pipfile
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/pipfile.py", line 23, in <module>
    from ..environment import MYPY_RUNNING
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/environment.py", line 17, in <module>
    MYPY_RUNNING = os.environ.get("MYPY_RUNNING", is_type_checking())
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/environment.py", line 10, in is_type_checking
    from typing import TYPE_CHECKING
  File "/home/ninja/anaconda/lib/python3.6/site-packages/typing.py", line 133
    def __new__(cls, name, bases, namespace, *, _root=False):
                                              ^
SyntaxError: invalid syntax
File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 126, in <module>
    main()
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 119, in main
    parsed.requirements_dir, parsed.packages)
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 85, in _main
    requirements_dir=requirements_dir,
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/resolver.py", line 69, in resolve
    req_dir=requirements_dir
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/utils.py", line 700, in resolve_deps
    from .vendor.requirementslib.models.requirements import Requirement
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/__init__.py", line 14, in <module>
    from .models.pipfile import Pipfile
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/pipfile.py", line 23, in <module>
    from ..environment import MYPY_RUNNING
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/environment.py", line 17, in <module>
    MYPY_RUNNING = os.environ.get("MYPY_RUNNING", is_type_checking())
  File "/home/ninja/anaconda/lib/python3.6/site-packages/pipenv/vendor/requirementslib/environment.py", line 10, in is_type_checking
    from typing import TYPE_CHECKING
  File "/home/ninja/anaconda/lib/python3.6/site-packages/typing.py", line 133
    def __new__(cls, name, bases, namespace, *, _root=False):
                                              ^
SyntaxError: invalid syntax

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
frostmingcommented, Mar 26, 2020

This is not a release blocker, moving it out of the milestone.

0reactions
brainwanecommented, Mar 24, 2020

Just spoke with @techalchemy and he needs more info to decide whether this still needs fixing. @ninja18 can you try what @frostming suggested in https://github.com/pypa/pipenv/issues/3520#issuecomment-473632436 and tell us whether it worked for you?

Read more comments on GitHub >

github_iconTop Results From Across the Web

typing — Support for type hints — Python 3.11.1 documentation
It is invalid to create a subtype of Derived : from typing import NewType UserId = NewType('UserId', int) # Fails at runtime and...
Read more >
Python 3 type check not works with use typing module?
Python's type hints are informational only. Type checking or automatic coercion of argument types are not part of the language.
Read more >
The `if TYPE_CHECKING` problem · Issue #1 - GitHub
The problem is that this is a fairly common idiom: from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: ...
Read more >
Common issues and solutions - mypy 0.991 documentation
Statically typed code is often identical to normal Python code (except for ... There are several common reasons why obviously wrong code is...
Read more >
Python Type Checking (Guide) - Real Python
In this guide, you'll look at Python type checking. Traditionally, types have been handled by the Python interpreter in a flexible but implicit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found