Skip to content
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

Installation problem Python 3.11.2 #3

Open
KristjanESPERANTO opened this issue Jun 27, 2023 · 4 comments
Open

Installation problem Python 3.11.2 #3

KristjanESPERANTO opened this issue Jun 27, 2023 · 4 comments
Labels

Comments

@KristjanESPERANTO
Copy link
Contributor

I can't install the module with Python 3.11.2 under Debian 12.

Do you have an idea how to solve it?

$ python -V
Python 3.11.2
$ pip install pyopening_hours      
Defaulting to user installation because normal site-packages is not writeable
Collecting pyopening_hours
  Using cached pyopening_hours-0.3.0.tar.gz (926 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [32 lines of output]
      running egg_info
      creating /tmp/pip-pip-egg-info-sx2y4cwt/pyopening_hours.egg-info
      writing /tmp/pip-pip-egg-info-sx2y4cwt/pyopening_hours.egg-info/PKG-INFO
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-082a71dz/pyopening-hours_bd81c33c0d984e219ca7ef867e8de6d5/setup.py", line 12, in <module>
          setup(
        File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 1213, in run_command
          super().run_command(command)
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 305, in run
          writer(self, ep.name, os.path.join(self.egg_info, ep.name))
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 687, in write_pkg_info
          metadata.write_pkg_info(cmd.egg_info)
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 1137, in write_pkg_info
          self.write_pkg_file(pkg_info)
        File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 232, in write_pkg_file
          if not long_description.endswith("\n"):
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: 'tuple' object has no attribute 'endswith'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
@ypid ypid added the bug label Jun 30, 2023
@SlowMo24
Copy link

SlowMo24 commented Jul 16, 2023

same under 3.10.12

python 3.8.10 reports

Collecting pyopening_hours
  Using cached pyopening_hours-0.3.0.tar.gz (926 kB)
    ERROR: Command errored out with exit status 1:
     command: ~/venv3.8/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bxu2mmaf/pyopening-hours/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bxu2mmaf/pyopening-hours/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 /tmp/pip-install-bxu2mmaf/pyopening-hours/pip-egg-info
         cwd: /tmp/pip-install-bxu2mmaf/pyopening-hours/
    Complete output (26 lines):
    running egg_info
    creating /tmp/pip-install-bxu2mmaf/pyopening-hours/pip-egg-info/pyopening_hours.egg-info
    writing /tmp/pip-install-bxu2mmaf/pyopening-hours/pip-egg-info/pyopening_hours.egg-info/PKG-INFO
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-bxu2mmaf/pyopening-hours/setup.py", line 12, in <module>
        setup(
      File "~/venv3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "~/venv3.8/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 289, in run
        writer(self, ep.name, os.path.join(self.egg_info, ep.name))
      File "~/venv3.8/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 621, in write_pkg_info
        metadata.write_pkg_info(cmd.egg_info)
      File "/usr/lib/python3.8/distutils/dist.py", line 1117, in write_pkg_info
        self.write_pkg_file(pkg_info)
      File "~/venv3.8/lib/python3.8/site-packages/setuptools/dist.py", line 167, in write_pkg_file
        long_desc = rfc822_escape(self.get_long_description())
      File "/usr/lib/python3.8/distutils/util.py", line 475, in rfc822_escape
        lines = header.split('\n')
    AttributeError: 'tuple' object has no attribute 'split'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

python 2.7 works, but that is deprecated.

@SlowMo24
Copy link

If you really need it NOW here is a workaround for python 3.10 ( 🤣 ) :

  1. clone and build this repository: git clone https://github.com/opening-hours/pyopening_hours
  2. cd pyopening_hours/
  3. make dependencies-get
  4. run npm install optimist
  5. download this file https://github.com/opening-hours/opening_hours.js/blob/ce274d2d485f74bd5ab222b45a11f6f4b4ed67b8/scripts/interactive_testing.js to node_modules/opening_hours/
  6. copy the folder build from node_modules/opening_hours/ one hierarchy up directly into node_modules: cp -r node_modules/opening_hours/build node_modules/
  7. copy the folder node_modules to pyopening_hours/ (replacing the existing one): cp -r node_modules pyopening_hours/
  8. copy the folder pyopening_hours (containing OpeningHours.py and node_modules/) to your site-packages/ folder or wherever your python libs are located

done

@KristjanESPERANTO
Copy link
Contributor Author

@SlowMo24: Nice! It looks to me like you found the cause. I don't get it yet. Can you create a PR?

@SlowMo24
Copy link

SlowMo24 commented Jul 20, 2023

The following is no critique! I think we should thank the people who offered these tools they created in their free time and is only healthy if they now follow new endeavours.


I don't think I found the cause. This module has not been maintained for a while and has gotten out of touch with the dependency. I found a work around by reverting the dependency to an earlier status as the package expects it.

I think this package will need a rework to get back in line with the https://github.com/opening-hours/opening_hours.js/ . But I have too little experience with the way POPEN is used here and seeing this comment #4 (comment) it seems implausible that that will happen here.

I will try KOpeninghours and see how far I can get: https://wiki.openstreetmap.org/wiki/Key:opening_hours#Python

//edit: not far (not even installation) but this one seems to work: https://pypi.org/project/opening-hours-py/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants