MonetDB/pymonetdb

Cannot use the library on 3.7

Closed this issue · 5 comments

When using the library and try to build a project using python3.7, we have recently this error.

ERROR: You need Python 2.7 or 3.4 to install the typing package.

I was able to reproduce this error from the version 1.3.1 until 1.2.1, works fine on 1.1.1

i experience no issues installing pymonetdb with python3.7. I can also install the typing package:

$  virtualenv -p python3.7 venv
$ venv/bin/pip install --upgrade pip
Collecting pip
  Using cached pip-20.1.1-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.0.2
    Uninstalling pip-20.0.2:
      Successfully uninstalled pip-20.0.2
Successfully installed pip-20.1.1
$  venv/bin/pip install typing       
Collecting typing
  Using cached typing-3.7.4.1-py3-none-any.whl (25 kB)
Installing collected packages: typing
Successfully installed typing-3.7.4.1
$  venv/bin/pip install git+https://github.com/gijzelaerr/pymonetdb
Collecting git+https://github.com/gijzelaerr/pymonetdb
  Cloning https://github.com/gijzelaerr/pymonetdb to /tmp/pip-req-build-epv35bje
  Running command git clone -q https://github.com/gijzelaerr/pymonetdb /tmp/pip-req-build-epv35bje
Processing /home/gijs/.cache/pip/wheels/56/b0/fe/4410d17b32f1f0c3cf54cdfb2bc04d7b4b8f4ae377e2229ba0/future-0.18.2-py3-none-any.whl
Building wheels for collected packages: pymonetdb
  Building wheel for pymonetdb (setup.py) ... done
  Created wheel for pymonetdb: filename=pymonetdb-2.0.0-py2.py3-none-any.whl size=31161 sha256=9beb4a8324bc11d643c4850058faeebe33f8f400e2
d100121e3f4652d3a36071
  Stored in directory: /tmp/pip-ephem-wheel-cache-gfarat1n/wheels/84/6d/06/cb5fad2625b4cf465028cc3fded5c26f775b847f8e0abf5a44
Successfully built pymonetdb
Installing collected packages: future, pymonetdb
Successfully installed future-0.18.2 pymonetdb-2.0.0
gijs@gijs-artica:~/tmp  
$ venv/bin/python
Python 3.7.8 (default, Jun 29 2020, 04:26:04) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymonetdb
>>> 

To me this sounds that something somewhere gets confused about which python is being used. How are you installing your software? using pip?

try the following:

  • Make sure you are using the right python and pip version (not python2)
  • Update the pip in your virtualenv (pip install --upgrade pip)
  • Try installing typing manually (pip install typing)

I am currently using setuptools, with a setup.py.

Basically, this is how we did.

import os
from setuptools import setup

setup(
    name = "an_example_pypi_project",
    version = "0.0.4",
    author = "",
    author_email = "",
    description = (""),
    license = "BSD",
    keywords = "",
    url = "",
    packages=[],
    long_description="",
    install_requires=["pymonetdb"],
    classifiers=[
    ],
)

with directly a python3 setup.py install

and the output of our current version:

Python 3.7.5

I can confirm this issue when using python3 setup.py install:

$  venv37/bin/python setup.py install                                                   
running install                             
running bdist_egg                           
running egg_info                            
creating an_example_pypi_project.egg-info                                               
writing an_example_pypi_project.egg-info/PKG-INFO                                       
writing dependency_links to an_example_pypi_project.egg-info/dependency_links.txt                                                                                               
writing requirements to an_example_pypi_project.egg-info/requires.txt                                                                                                           
writing top-level names to an_example_pypi_project.egg-info/top_level.txt                                                                                                       
writing manifest file 'an_example_pypi_project.egg-info/SOURCES.txt'                                                                                                            
reading manifest file 'an_example_pypi_project.egg-info/SOURCES.txt'                                                                                                            
writing manifest file 'an_example_pypi_project.egg-info/SOURCES.txt'                                                                                                            
installing library code to build/bdist.linux-x86_64/egg                                 
running install_lib                         
warning: install_lib: 'build/lib' does not exist -- no Python modules to install                                                                                                
[...] 

Installed /home/gijs/tmp/venv37/lib/python3.7/site-packages/pymonetdb-1.3.1-py3.7.egg                                                                                           
Searching for typing                        
Reading https://pypi.org/simple/typing/                                                 
Downloading https://files.pythonhosted.org/packages/8f/00/c999df515e923dbb73281426f5032a3d12b68600e362af30ed2c495d1e79/typing-3.7.4.2.tar.gz#sha256=6f6f3553709d2234e412092e5daa93aaaaa42ea1854505442280b39f9311707f        
Best match: typing 3.7.4.2                  
Processing typing-3.7.4.2.tar.gz            
Writing /tmp/easy_install-ufgsw4cv/typing-3.7.4.2/setup.cfg                             
Running typing-3.7.4.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ufgsw4cv/typing-3.7.4.2/egg-dist-tmp-aq72neo7                                                         
ERROR: You need Python 2.7 or 3.4 to install the typing package.                        
error: Setup script exited with 1           

I'm not sure what is wrong, but it might be that the typing module is not compatible anymore with this old setuptools way of installing packages. Using pip with your example setuptools script seems to work though:

Processing /home/gijs/tmp
Requirement already satisfied: pymonetdb in ./venv37/lib/python3.7/site-packages/pymonetdb-1.3.1-py3.7.egg (from an-example-pypi-project==0.0.4) (1.3.1)
Processing /home/gijs/.cache/pip/wheels/56/b0/fe/4410d17b32f1f0c3cf54cdfb2bc04d7b4b8f4ae377e2229ba0/future-0.18.2-py3-none-any.whl
Requirement already satisfied: six>=1.12.0 in ./venv37/lib/python3.7/site-packages (from pymonetdb->an-example-pypi-project==0.0.4) (1.14.0)
Collecting typing
  Using cached typing-3.7.4.1-py3-none-any.whl (25 kB)
Building wheels for collected packages: an-example-pypi-project
  Building wheel for an-example-pypi-project (setup.py) ... done
  Created wheel for an-example-pypi-project: filename=an_example_pypi_project-0.0.4-py3-none-any.whl size=1165 sha256=dded6bcf8fdfacc800cb551b1b33068d47c5675b5027befab97e5321fffc018a
  Stored in directory: /tmp/pip-ephem-wheel-cache-7iwd5t0d/wheels/10/9f/6a/dfd932ff9a1e40da97522b1a5cfa7c3480fcc813f1bd534a9b
Successfully built an-example-pypi-project
Installing collected packages: an-example-pypi-project, future, typing
  Attempting uninstall: an-example-pypi-project
    Found existing installation: an-example-pypi-project 0.0.4
    Uninstalling an-example-pypi-project-0.0.4:
      Successfully uninstalled an-example-pypi-project-0.0.4
Successfully installed an-example-pypi-project-0.0.4 future-0.18.2 typing-3.7.4.1

I recommend you switch to pip for installing your package, since that is way forward for python package management and installations.

Since this is an issue with typing, not our software, we can't do much about this and we are not going to drop the typing dependency I'm going to close this issue. I hope this helps.

By the way, we did drop the typing requirement in our upcoming 2.0 release, which only supports 3.5+. We can drop it since 3.5+ is bundled with the typing module.

If you are stuck with the python setup.py method you can try to use the master version of this repository.