powerapi-ng/pyJoules

Cannot install pyJoules using pip

danglotb opened this issue · 4 comments

Hello,

I'm trying to install pyJoules using pip3 but I have the following error:

$ pip3 install pyJoules
Collecting pyJoules
  Could not find a version that satisfies the requirement pyJoules (from versions: )
No matching distribution found for pyJoules

I did try pip install pyJoules, resulting in the same message.

Any idea?

Thank you very much !

Here some info about my installation:

$ pip --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
$ python --version
Python 2.7.17
$ pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
$ python3 --version
Python 3.6.9

I tried to install pyJoules from the source tree with the following command line:

$ pip install -e pyJoules
Obtaining file:///home/benjamin/workspace/greenIt/pyjoules/pyJoules
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/benjamin/workspace/greenIt/pyjoules/pyJoules/setup.py", line 2, in <module>
        setup()
      File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python2.7/distutils/core.py", line 124, in setup
        dist.parse_config_files()
      File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 494, in parse_config_files
        ignore_option_errors=ignore_option_errors)
      File "/usr/lib/python2.7/dist-packages/setuptools/config.py", line 106, in parse_configuration
        meta.parse()
      File "/usr/lib/python2.7/dist-packages/setuptools/config.py", line 382, in parse
        section_parser_method(section_options)
      File "/usr/lib/python2.7/dist-packages/setuptools/config.py", line 355, in parse_section
        self[name] = value
      File "/usr/lib/python2.7/dist-packages/setuptools/config.py", line 173, in __setitem__
        value = parser(value)
      File "/usr/lib/python2.7/dist-packages/setuptools/config.py", line 430, in _parse_version
        version = self._parse_attr(value)
      File "/usr/lib/python2.7/dist-packages/setuptools/config.py", line 305, in _parse_attr
        module = import_module(module_name)
      File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
        __import__(name)
      File "/home/benjamin/workspace/greenIt/pyjoules/pyJoules/pyJoules/__init__.py", line 21, in <module>
        from .energy_sample import EnergySample
      File "/home/benjamin/workspace/greenIt/pyjoules/pyJoules/pyJoules/energy_sample.py", line 38
        timestamp: float
                 ^
    SyntaxError: invalid syntax
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /home/benjamin/workspace/greenIt/pyjoules/pyJoules/

The error is different with pip3:

$ pip3 install -e pyJoules
Obtaining file:///home/benjamin/workspace/greenIt/pyjoules/pyJoules
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/benjamin/workspace/greenIt/pyjoules/pyJoules/setup.py", line 2, in <module>
        setup()
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.6/distutils/core.py", line 121, in setup
        dist.parse_config_files()
      File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 494, in parse_config_files
        ignore_option_errors=ignore_option_errors)
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 106, in parse_configuration
        meta.parse()
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 382, in parse
        section_parser_method(section_options)
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 355, in parse_section
        self[name] = value
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 173, in __setitem__
        value = parser(value)
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 430, in _parse_version
        version = self._parse_attr(value)
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 305, in _parse_attr
        module = import_module(module_name)
      File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 994, in _gcd_import
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 678, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/home/benjamin/workspace/greenIt/pyjoules/pyJoules/pyJoules/__init__.py", line 21, in <module>
        from .energy_sample import EnergySample
      File "/home/benjamin/workspace/greenIt/pyjoules/pyJoules/pyJoules/energy_sample.py", line 20, in <module>
        from dataclasses import dataclass
    ModuleNotFoundError: No module named 'dataclasses'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /home/benjamin/workspace/greenIt/pyjoules/pyJoules/

Maybe I'm doing something wrong, but it looks like the problem comes from the same file, i.e. energy_sample.py.

I'm investigating, I keep you update.

I did find a solution.

I needed to install the module dataclasses with pip3 install dataclasses.
I also upgraded my python3.6 to python3.7.

I have the following output:

$ pip3 install -e pyJoules
Obtaining file:///home/benjamin/workspace/greenIt/pyjoules/pyJoules
Installing collected packages: pyJoules
  Running setup.py develop for pyJoules
Successfully installed pyJoules
$ python3 examples/fibo_with_pyjoules.py 10
WARNING:root:pynvml not found you can't use NVIDIA devices
begin timestamp : 1599658023442096736; tag : fib; duration : 147770; package_0 : 5554.0; dram_0 : 489.0; core_0 : 306.0; uncore_0 : 0.0
55

However, I still could not install pyJoules from pip3.

Thank you.

altor commented

Hello !

PyJoules need python 3.7 or higher because we use type annotations. With python3.7 you don't have to install the dataclass module

about installing pyjoules with pip issue, maybe the pip3 binary use the python3.6 version, try using this command : python3.7 -m pip install pyjoules

Hello @altor

I tried your command and it did the trick.

$ python3.7 -m pip install pyjoules
Collecting pyjoules
  Downloading https://files.pythonhosted.org/packages/29/a5/96745bf187c398aceaff86269466b5add5bffe0027639d2f1ea495cb2d92/pyJoules-0.3.0-py2.py3-none-any.whl (51kB)
    100% |████████████████████████████████| 51kB 2.0MB/s 
Installing collected packages: pyjoules
Successfully installed pyjoules-0.3.0

Thank you very much for your help 😄