Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Error installing on Python 3.9 #146

Closed
BrianMSheldon opened this issue Sep 25, 2020 · 12 comments · Fixed by #147
Closed

Error installing on Python 3.9 #146

BrianMSheldon opened this issue Sep 25, 2020 · 12 comments · Fixed by #147

Comments

@BrianMSheldon
Copy link

BrianMSheldon commented Sep 25, 2020

Pretty sure this is the same issue as #126 but its really annoying that this occurs for every new python release, especially since the first 3.9 testing release has been out for almost a year and final is supposed to be out in a week.. Sorry didn't see readme explicitly states that python 3.8+ are not supported.

@gvanrossum
Copy link
Member

I think the fix will be separate though, so it's useful to track this separately.

Also, while no effort will be made to support parsing Python 3.8+ using typed_ast, we may want to support parsing Python 2.7 for mypy for quite a while longer, and (once 3.9 is really out :-) it would be a bit annoying (though not truly prohibitive) to have to install an earlier version of Python for that.

If #147 works I may be able to fix this by building wheels for 3.9.

@b0g3r
Copy link

b0g3r commented Oct 8, 2020

@gvanrossum Just to clarify, #147 will add wheels only for windows? As I see on pypi typed-ast also doesn't have wheels for py3.9 manylinux and it unfortunately blocked our migration to 3.9 😢. Maybe while appveyor fixes appveyor/ci#3541 (it can take a few weeks), typed-ast's CI/CD can build linux wheels and publish it?

But I'm not sure what to do with a release process of typed-ast, looks like it'll require two releases (one for manylinux, and one for win) and it will be easier to just little wait.

So, It would be great if typed-ast publish linux wheels, but I understand with respect if you decide to do it in one batch.

@meteoritt
Copy link

meteoritt commented Oct 14, 2020

Have any problem with install black: psf/black#1744 on latest Windows 10 64-bit.

Microsoft Visual C++ 14.0 Build installed.

Use PyCharm 2020.2 with Python 3.9 from chocolatey: https://chocolatey.org/packages/python3/3.9.0

D:\user\Dev\git\project>pip install typed-ast
Collecting typed-ast
  Using cached typed_ast-1.4.1.tar.gz (208 kB)
Building wheels for collected packages: typed-ast
  Building wheel for typed-ast (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\user\python39\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-tl5g80gw\\typed-ast\\setup.py'"'"'; __file__='"'"'C:\\Users\\
user\\AppData\\Local\\Temp\\pip-install-tl5g80gw\\typed-ast\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"
'"'))' bdist_wheel -d 'C:\Users\user\AppData\Local\Temp\pip-wheel-aruh6dru'
       cwd: C:\Users\user\AppData\Local\Temp\pip-install-tl5g80gw\typed-ast\
  Complete output (16 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\typed_ast
  copying typed_ast\ast27.py -> build\lib.win-amd64-3.9\typed_ast
  copying typed_ast\ast3.py -> build\lib.win-amd64-3.9\typed_ast
  copying typed_ast\conversions.py -> build\lib.win-amd64-3.9\typed_ast
  copying typed_ast\__init__.py -> build\lib.win-amd64-3.9\typed_ast
  package init file 'ast3\tests\__init__.py' not found (or not a regular file)
  creating build\lib.win-amd64-3.9\typed_ast\tests
  copying ast3\tests\test_basics.py -> build\lib.win-amd64-3.9\typed_ast\tests
  running build_ext
  building '_ast27' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for typed-ast
  Running setup.py clean for typed-ast
Failed to build typed-ast
Installing collected packages: typed-ast
    Running setup.py install for typed-ast ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\user\python39\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-tl5g80gw\\typed-ast\\setup.py'"'"'; __file__='"'"'C:\\Users
\\user\\AppData\\Local\\Temp\\pip-install-tl5g80gw\\typed-ast\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec
'"'"'))' install --record 'C:\Users\user\AppData\Local\Temp\pip-record-xcb8fyc2\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\user\python39\include\site\python3.9\typed-ast'
         cwd: C:\Users\user\AppData\Local\Temp\pip-install-tl5g80gw\typed-ast\
    Complete output (16 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    creating build\lib.win-amd64-3.9\typed_ast
    copying typed_ast\ast27.py -> build\lib.win-amd64-3.9\typed_ast
    copying typed_ast\ast3.py -> build\lib.win-amd64-3.9\typed_ast
    copying typed_ast\conversions.py -> build\lib.win-amd64-3.9\typed_ast
    copying typed_ast\__init__.py -> build\lib.win-amd64-3.9\typed_ast
    package init file 'ast3\tests\__init__.py' not found (or not a regular file)
    creating build\lib.win-amd64-3.9\typed_ast\tests
    copying ast3\tests\test_basics.py -> build\lib.win-amd64-3.9\typed_ast\tests
    running build_ext
    building '_ast27' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\user\python39\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-tl5g80gw\\typed-ast\\setup
.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-tl5g80gw\\typed-ast\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(
compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\user\AppData\Local\Temp\pip-record-xcb8fyc2\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\user\python39\include
\site\python3.9\typed-ast' Check the logs for full command output.

(python39) D:\user\Dev\git\project>python --version
Python 3.9.0

pip install --upgrade setuptools pip wheel
Requirement already up-to-date: setuptools in c:\users\user\python39\lib\site-packages (50.3.0)
Requirement already up-to-date: pip in c:\users\user\python39\lib\site-packages (20.2.3)
Requirement already up-to-date: wheel in c:\users\user\python39\lib\site-packages (0.35.1)

@meteoritt
Copy link

pip install --only-binary=:all: typed-ast
ERROR: Could not find a version that satisfies the requirement typed-ast (from versions: none)
ERROR: No matching distribution found for typed-ast

@RomanKornev
Copy link

Had the same error, solved it by running sudo apt install python3.9-dev from deadsnakes/ppa/ubuntu

Error log WSL-Ubuntu:
❯ /bin/python3.9 /home/df/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py pip install -U mypy --user
Collecting mypy
Using cached mypy-0.790-py3-none-any.whl (2.4 MB)
Requirement already satisfied, skipping upgrade: typing-extensions>=3.7.4 in /home/df/.local/lib/python3.9/site-packages (from mypy) (3.7.4.3)
Collecting typed-ast<1.5.0,>=1.4.0
Using cached typed_ast-1.4.1.tar.gz (208 kB)
Requirement already satisfied, skipping upgrade: mypy-extensions<0.5.0,>=0.4.3 in /home/df/.local/lib/python3.9/site-packages (from mypy) (0.4.3)
Building wheels for collected packages: typed-ast
Building wheel for typed-ast (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tnfc0fcn/typed-ast/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tnfc0fcn/typed-ast/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-i7q_8xvj
    cwd: /tmp/pip-install-tnfc0fcn/typed-ast/
Complete output (26 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/typed_ast
copying typed_ast/ast27.py -> build/lib.linux-x86_64-3.9/typed_ast
copying typed_ast/ast3.py -> build/lib.linux-x86_64-3.9/typed_ast
copying typed_ast/conversions.py -> build/lib.linux-x86_64-3.9/typed_ast
copying typed_ast/__init__.py -> build/lib.linux-x86_64-3.9/typed_ast
package init file 'ast3/tests/__init__.py' not found (or not a regular file)
creating build/lib.linux-x86_64-3.9/typed_ast/tests
copying ast3/tests/test_basics.py -> build/lib.linux-x86_64-3.9/typed_ast/tests
running build_ext
building '_ast27' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/ast27
creating build/temp.linux-x86_64-3.9/ast27/Custom
creating build/temp.linux-x86_64-3.9/ast27/Parser
creating build/temp.linux-x86_64-3.9/ast27/Python
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/usr/include/python3.9 -c ast27/Custom/typed_ast.c -o build/temp.linux-x86_64-3.9/ast27/Custom/typed_ast.o
ast27/Custom/typed_ast.c:1:10: fatal error: Python.h: No such file or directory
   1 | #include "Python.h"
     |          ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for typed-ast
Running setup.py clean for typed-ast
Failed to build typed-ast
Installing collected packages: typed-ast, mypy
 Running setup.py install for typed-ast ... error
 ERROR: Command errored out with exit status 1:
  command: /bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tnfc0fcn/typed-ast/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tnfc0fcn/typed-ast/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-t5rofrlv/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/df/.local/include/python3.9/typed-ast
      cwd: /tmp/pip-install-tnfc0fcn/typed-ast/
 Complete output (26 lines):
 running install
 running build
 running build_py
 creating build
 creating build/lib.linux-x86_64-3.9
 creating build/lib.linux-x86_64-3.9/typed_ast
 copying typed_ast/ast27.py -> build/lib.linux-x86_64-3.9/typed_ast
 copying typed_ast/ast3.py -> build/lib.linux-x86_64-3.9/typed_ast
 copying typed_ast/conversions.py -> build/lib.linux-x86_64-3.9/typed_ast
 copying typed_ast/__init__.py -> build/lib.linux-x86_64-3.9/typed_ast
 package init file 'ast3/tests/__init__.py' not found (or not a regular file)
 creating build/lib.linux-x86_64-3.9/typed_ast/tests
 copying ast3/tests/test_basics.py -> build/lib.linux-x86_64-3.9/typed_ast/tests
 running build_ext
 building '_ast27' extension
 creating build/temp.linux-x86_64-3.9
 creating build/temp.linux-x86_64-3.9/ast27
 creating build/temp.linux-x86_64-3.9/ast27/Custom
 creating build/temp.linux-x86_64-3.9/ast27/Parser
 creating build/temp.linux-x86_64-3.9/ast27/Python
 x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/usr/include/python3.9 -c ast27/Custom/typed_ast.c -o build/temp.linux-x86_64-3.9/ast27/Custom/typed_ast.o
 ast27/Custom/typed_ast.c:1:10: fatal error: Python.h: No such file or directory
     1 | #include "Python.h"
       |          ^~~~~~~~~~
 compilation terminated.
 error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
 ----------------------------------------
ERROR: Command errored out with exit status 1: /bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tnfc0fcn/typed-ast/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tnfc0fcn/typed-ast/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-t5rofrlv/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/df/.local/include/python3.9/typed-ast Check the logs for full command output.
❯ sudo apt install python3.9-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
libpython3.9 libpython3.9-dev
The following NEW packages will be installed:
libpython3.9 libpython3.9-dev python3.9-dev
0 upgraded, 3 newly installed, 0 to remove and 3 not upgraded.
Need to get 6740 kB of archives.
After this operation, 27.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.9 amd64 3.9.0-1+focal4 [1872 kB]
Get:2 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.9-dev amd64 3.9.0-1+focal4 [4368 kB]
Get:3 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 python3.9-dev amd64 3.9.0-1+focal4 [501 kB]
Fetched 6740 kB in 1s (4546 kB/s)     
Selecting previously unselected package libpython3.9:amd64.
(Reading database ... 67225 files and directories currently installed.)
Preparing to unpack .../libpython3.9_3.9.0-1+focal4_amd64.deb ...
Unpacking libpython3.9:amd64 (3.9.0-1+focal4) ...
Selecting previously unselected package libpython3.9-dev:amd64.
Preparing to unpack .../libpython3.9-dev_3.9.0-1+focal4_amd64.deb ...
Unpacking libpython3.9-dev:amd64 (3.9.0-1+focal4) ...
Selecting previously unselected package python3.9-dev.
Preparing to unpack .../python3.9-dev_3.9.0-1+focal4_amd64.deb ...
Unpacking python3.9-dev (3.9.0-1+focal4) ...
Setting up libpython3.9:amd64 (3.9.0-1+focal4) ...
Setting up libpython3.9-dev:amd64 (3.9.0-1+focal4) ...
Setting up python3.9-dev (3.9.0-1+focal4) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
❯ /bin/python3.9 /home/df/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py pip install -U mypy --user
Collecting mypy
Using cached mypy-0.790-py3-none-any.whl (2.4 MB)
Collecting typed-ast<1.5.0,>=1.4.0
Using cached typed_ast-1.4.1.tar.gz (208 kB)
Requirement already satisfied, skipping upgrade: mypy-extensions<0.5.0,>=0.4.3 in /home/df/.local/lib/python3.9/site-packages (from mypy) (0.4.3)
Requirement already satisfied, skipping upgrade: typing-extensions>=3.7.4 in /home/df/.local/lib/python3.9/site-packages (from mypy) (3.7.4.3)
Building wheels for collected packages: typed-ast
Building wheel for typed-ast (setup.py) ... done
Created wheel for typed-ast: filename=typed_ast-1.4.1-cp39-cp39-linux_x86_64.whl size=779552 sha256=c198aa58c863dcf4e5260a77105c8623a36b184d602f6e98729033cda75e5fb6
Stored in directory: /home/df/.cache/pip/wheels/76/9d/0a/92a418f064e7c1baabbdc49a4168b9ae8bda647cf06edab936
Successfully built typed-ast
Installing collected packages: typed-ast, mypy
Successfully installed mypy-0.790 typed-ast-1.4.1

@hoefling
Copy link

hoefling commented Oct 24, 2020

#147 is green now, so windows users can download prebuilt cp39-win32 and cp39-win_amd64 wheels and install them locally via pip install path\to\typed_ast-1.4.1-cp39-cp39-win*.whl. Still, it would be awesome if @ddfisher, @gvanrossum, @JukkaL or @msullivan can publish those wheels to PyPI to ease the pain.

@HamidMandi
Copy link

Had the same error, solved it by running sudo apt install python3.9-dev from deadsnakes/ppa/ubuntu

Error log
sudo apt install python3.9-dev works for me

@th-520
Copy link

th-520 commented May 6, 2022

image

typed-ast==1.4 python3.912 mac m1

@JelleZijlstra
Copy link
Member

1.4 is old. Please use the latest version.

@daichigb
Copy link

daichigb commented May 6, 2022

I do have the same error as @th-520 on a MAC M1... I can't really upgrade atm for dependencies reason.

@JelleZijlstra
Copy link
Member

You'll have to find a way to upgrade. If you're using an old version of mypy that requires typed_ast<1.5, you should be able to just use the latest version of typed-ast and ignore the dependency mismatch. I don't think typed-ast has made any incompatible changes.

@th-520
Copy link

th-520 commented May 7, 2022

You'll have to find a way to upgrade. If you're using an old version of mypy that requires typed_ast<1.5, you should be able to just use the latest version of typed-ast and ignore the dependency mismatch. I don't think typed-ast has made any incompatible changes.

thank you

@python python locked as resolved and limited conversation to collaborators May 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants