scs / smartmeter-datacollector

Smart Meter Data Collector
Other
57 stars 23 forks source link

Cannot setup dev environment with python 3.10 on ubuntu 22.04 #39

Closed kreutpet closed 1 year ago

kreutpet commented 1 year ago

i am trying to setup the development environment but i cannot get the command pipenv command running

pipenv install --dev
Traceback (most recent call last):
  File "/usr/bin/pipenv", line 33, in <module>
    sys.exit(load_entry_point('pipenv==11.9.0', 'console_scripts', 'pipenv')())
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 696, in main
    with self.make_context(prog_name, args, **extra) as ctx:
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 621, in make_context
    self.parse_args(ctx, args)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 1018, in parse_args
    rest = Command.parse_args(self, ctx, args)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 875, in parse_args
    parser = self.make_parser(ctx)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 821, in make_parser
    for param in self.get_params(ctx):
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 774, in get_params
    help_option = self.get_help_option(ctx)
  File "/usr/lib/python3/dist-packages/pipenv/cli.py", line 26, in get_help_option
    from .import core
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 21, in <module>
    import requests
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requests/__init__.py", line 65, in <module>
    from . import utils
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requests/utils.py", line 27, in <module>
    from .cookies import RequestsCookieJar, cookiejar_from_dict
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requests/cookies.py", line 172, in <module>
    class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'

what is the best way to handle this ?

Montellese commented 1 year ago

Please see https://github.com/pypa/pipenv/issues/5088 and give it a try. It looks like the version of pipenv provided by Ubuntu packages is outdated and not compatible with Python 3.10. Try uninstalling the APT package and use pip install pipenv to install pipenv.

kreutpet commented 1 year ago

many thanks . i tied to install the pipenv with recommend command but end up in another issue. python 3.10 is installed but when running the command 3.8 is needed.

root@dlms:~/smartmeter-datacollector# /usr/local/bin/pipenv install --dev
Warning: Python 3.8 was not found on your system...
Neither 'pyenv' nor 'asdf' could be found to install Python.
You can specify specific versions of Python with:
$ pipenv --python path/to/python

I could not find any specific dependency in your code.

raymar9 commented 1 year ago

But there is a requirement in the Pipfile:

[requires]
python_version = "3.8"

You can try using another Python version by initializing the environment with:

pipenv --python three install --dev
OR
pipenv --python 3.10 install --dev
OR
pipenv --python <path to Python> install --dev

This should override the setting in the Pipfile. Please see https://pipenv-fork.readthedocs.io/en/latest/basics.html#specifying-versions-of-python for further information.

You can also comment out the line in the Pipfile for your setup if the above methods do not work.

We specified version 3.8 because the Raspbian distribution we use for the demo has Python 3.8 installed by default.

kreutpet commented 1 year ago

actually i gave up on ubuntu 22.04 and installed 20.4 which has python3.8 i guess sooner or later it will be solved for 22.04 i do have it up and running now in 20.04. it is the first time i use pipenv. What would be the next steps to start the smartmeter-datacollector manually for debugging? i assume pipenv shell would be need to enter into the environment?

thanks for the support

raymar9 commented 1 year ago

pipenv shell sets up the shell with the correct Python environment (virtualenv) and its dependencies which you previously installed by pipenv install. Then you start the software with python -m smartmeter-datacollector -c <config.ini path>. Please see the README or our Wiki for more information.

kreutpet commented 1 year ago

many thanks. i missed the pipenv install.