"pip install models" fails with error code 1 "No module named 'base'

Viewed 1088

Using Python 3.9 on Windows 10

I need to import module "TSheets" but it throws an exception on one of its dependencies:

from tsheets.api import TSheets

Exception has occurred: ModuleNotFoundError: No module named 'models'

When I try to install models

pip install models

I get the output

Collecting models
  Using cached models-0.9.3.tar.gz (16 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\python39\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\rober\\AppData\\Local\\Temp\\pip-install-utzl8ihq\\models_a160fe5c40f44b6180918e508f09440a\\setup.py'"'"'; __file__='"'"'C:\\Users\\rober\\AppData\\Local\\Temp\\pip-install-utzl8ihq\\models_a160fe5c40f44b6180918e508f09440a\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\rober\AppData\Local\Temp\pip-pip-egg-info-ijs4wmiu'
         cwd: C:\Users\rober\AppData\Local\Temp\pip-install-utzl8ihq\models_a160fe5c40f44b6180918e508f09440a\
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\rober\AppData\Local\Temp\pip-install-utzl8ihq\models_a160fe5c40f44b6180918e508f09440a\setup.py", line 25, in <module>
        import models
      File "C:\Users\rober\AppData\Local\Temp\pip-install-utzl8ihq\models_a160fe5c40f44b6180918e508f09440a\models\__init__.py", line 23, in <module>
        from base import *
    ModuleNotFoundError: No module named 'base'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/92/3c/ac1ddde60c02b5a46993bd3c6f4c66a9dbc100059da8333178ce17a22db5/models-0.9.3.tar.gz#sha256=b5aa29c6b57a667cda667dd9fbd33bbd15c14cc285e57dda64f4f4c0fd35e0ae (from https://pypi.org/simple/models/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I've seen similar issues that turned out to be path issues on Windows, but I'm not sure how to fix this particular case.

My Python 3.9 installation is at the path C:\Python39 to avoid any Windows user issues.

I also get errors when I try

pip install base

Thanks for any ideas or pointers!

1 Answers

That models package on PyPI is not related to TSheets. See this issue:

https://github.com/TSheetsTeam/api_python/issues/7

According to a comment installing it from the github repo should fix it:

pip install --upgrade git+https://github.com/TSheetsTeam/api_python.git@301666970a2b70bb43b712923b8e48c412fda13a#egg=tsheets
Related