-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
dbt gives a misleading error when attempting to install with python 2 #2347
Comments
Hi everyone! Since this is marked as a |
**Introduction** This PR attempts to fix #2347, wherein we wish `dbt` to complain about trying to install with a Python version < 3.6. **Changes** Per [the issue's suggestion](dbt-labs/dbt-core#2347), I found every `setup.py` file I could: ``` -# If you have the fantastic `fd` utility installed: fd setup.py -# This also works find . -name setup.py -print ``` Then to each of these, I added the following after the `import sys`: ``` if sys.version_info < (3, 6): print('Error: dbt does not support this version of Python.') print('Please upgrade to Python 3.6 or higher.') sys.exit(1) ``` **Testing** I used the [`nix` package manager](https://nixos.org) to attempt installing this branch with both Python 2.7 and Python 3.8. _Python 2.7_ fails as expected: ``` ~/github/test2 ∃ cat default.nix let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz") { }; py = pkgs.python27Full.withPackages (p: [ p.setuptools ]); in pkgs.mkShell { name = "python-2-env"; buildInputs = [ py ]; } ~/github/test2 ∃ nix-shell --pure [nix-shell:~/github/test2]$ python ../dbt/setup.py build Error: dbt does not support this version of Python. Please upgrade to Python 3.6 or higher. [nix-shell:~/github/test2]$ echo $? 1 ``` _Python 3.8_ still works: ``` ~/github/test3 ∃ cat default.nix let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz") { }; py = pkgs.python38Full.withPackages (p: [ p.setuptools ]); in pkgs.mkShell { name = "python-3-env"; buildInputs = [ py ]; } ~/github/test3 ∃ nix-shell --pure [nix-shell:~/github/test3]$ python ../dbt/setup.py build running build [nix-shell:~/github/test3]$ echo $? 0 ```
**Introduction** This PR attempts to fix #2347, wherein we wish `dbt` to complain about trying to install with a Python version < 3.6. **Changes** Per [the issue's suggestion](dbt-labs/dbt-core#2347), I found every `setup.py` file I could: ``` -# If you have the fantastic `fd` utility installed: fd setup.py -# This also works find . -name setup.py -print ``` Then to each of these, I added the following after the `import sys`: ``` if sys.version_info < (3, 6): print('Error: dbt does not support this version of Python.') print('Please upgrade to Python 3.6 or higher.') sys.exit(1) ``` **Testing** I used the [`nix` package manager](https://nixos.org) to attempt installing this branch with both Python 2.7 and Python 3.8. _Python 2.7_ fails as expected: ``` ~/github/test2 ∃ cat default.nix let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz") { }; py = pkgs.python27Full.withPackages (p: [ p.setuptools ]); in pkgs.mkShell { name = "python-2-env"; buildInputs = [ py ]; } ~/github/test2 ∃ nix-shell --pure [nix-shell:~/github/test2]$ python ../dbt/setup.py build Error: dbt does not support this version of Python. Please upgrade to Python 3.6 or higher. [nix-shell:~/github/test2]$ echo $? 1 ``` _Python 3.8_ still works: ``` ~/github/test3 ∃ cat default.nix let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz") { }; py = pkgs.python38Full.withPackages (p: [ p.setuptools ]); in pkgs.mkShell { name = "python-3-env"; buildInputs = [ py ]; } ~/github/test3 ∃ nix-shell --pure [nix-shell:~/github/test3]$ python ../dbt/setup.py build running build [nix-shell:~/github/test3]$ echo $? 0 ```
**Introduction** This PR attempts to fix #2347, wherein we wish `dbt` to complain about trying to install with a Python version < 3.6. **Changes** Per [the issue's suggestion](dbt-labs/dbt-core#2347), I found every `setup.py` file I could: ``` -# If you have the fantastic `fd` utility installed: fd setup.py -# This also works find . -name setup.py -print ``` Then to each of these, I added the following after the `import sys`: ``` if sys.version_info < (3, 6): print('Error: dbt does not support this version of Python.') print('Please upgrade to Python 3.6 or higher.') sys.exit(1) ``` **Testing** I used the [`nix` package manager](https://nixos.org) to attempt installing this branch with both Python 2.7 and Python 3.8. _Python 2.7_ fails as expected: ``` ~/github/test2 ∃ cat default.nix let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz") { }; py = pkgs.python27Full.withPackages (p: [ p.setuptools ]); in pkgs.mkShell { name = "python-2-env"; buildInputs = [ py ]; } ~/github/test2 ∃ nix-shell --pure [nix-shell:~/github/test2]$ python ../dbt/setup.py build Error: dbt does not support this version of Python. Please upgrade to Python 3.6 or higher. [nix-shell:~/github/test2]$ echo $? 1 ``` _Python 3.8_ still works: ``` ~/github/test3 ∃ cat default.nix let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz") { }; py = pkgs.python38Full.withPackages (p: [ p.setuptools ]); in pkgs.mkShell { name = "python-3-env"; buildInputs = [ py ]; } ~/github/test3 ∃ nix-shell --pure [nix-shell:~/github/test3]$ python ../dbt/setup.py build running build [nix-shell:~/github/test3]$ echo $? 0 ```
At a glance this code appears to be in the main branch now, however I just tried a few installs on mac, and each still gives the original error. Here are some that I tried:
Also wonder why we recommend pip install and not just pip3 install, this seems to work fine:
|
On modern systems not using Python 2 (which isn’t even supported by the Python Foundation), pip is pip3. |
**Introduction** This PR attempts to fix #2347, wherein we wish `dbt` to complain about trying to install with a Python version < 3.6. **Changes** Per [the issue's suggestion](#2347), I found every `setup.py` file I could: ``` -# If you have the fantastic `fd` utility installed: fd setup.py -# This also works find . -name setup.py -print ``` Then to each of these, I added the following after the `import sys`: ``` if sys.version_info < (3, 6): print('Error: dbt does not support this version of Python.') print('Please upgrade to Python 3.6 or higher.') sys.exit(1) ``` **Testing** I used the [`nix` package manager](https://nixos.org) to attempt installing this branch with both Python 2.7 and Python 3.8. _Python 2.7_ fails as expected: ``` ~/github/test2 ∃ cat default.nix let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz") { }; py = pkgs.python27Full.withPackages (p: [ p.setuptools ]); in pkgs.mkShell { name = "python-2-env"; buildInputs = [ py ]; } ~/github/test2 ∃ nix-shell --pure [nix-shell:~/github/test2]$ python ../dbt/setup.py build Error: dbt does not support this version of Python. Please upgrade to Python 3.6 or higher. [nix-shell:~/github/test2]$ echo $? 1 ``` _Python 3.8_ still works: ``` ~/github/test3 ∃ cat default.nix let pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz") { }; py = pkgs.python38Full.withPackages (p: [ p.setuptools ]); in pkgs.mkShell { name = "python-3-env"; buildInputs = [ py ]; } ~/github/test3 ∃ nix-shell --pure [nix-shell:~/github/test3]$ python ../dbt/setup.py build running build [nix-shell:~/github/test3]$ echo $? 0 ``` automatic commit by git-black, original commits: 59bf43d
Describe the bug
Installing with python 2 and setuptools 44.1.0 (the last that supported python 2) gives an error of
Error: dbt requires setuptools v40.1.0 or higher.
. Instead, it should inform users that their python version is unsupported and instruct them to upgrade to 3.6+.Steps To Reproduce
pip install dbt
Expected behavior
An error saying that I can't install dbt with Python 2.x.
Screenshots and log output
N/A
System information
Which database are you using dbt with?
N/A
The output of
dbt --version
:N/A, but you can see it when installing 0.16.1
The operating system you're using:
Any
The output of
python --version
:2.7.18
Additional context
This should be very straightforward - before we look for
setuptools.find_namespace_packages
, ensure thatsys.version_info >= (3, 6)
! The only annoying part will be making sure to hit all 6 setup.py files.The text was updated successfully, but these errors were encountered: