ionelmc / pytest-benchmark

pytest fixture for benchmarking code
BSD 2-Clause "Simplified" License
1.25k stars 119 forks source link

unusable due to missing statistics #29

Open nzjrs opened 9 years ago

nzjrs commented 9 years ago

WARNING: Benchmarks are automatically disabled because we could not import statistics

Traceback (most recent call last): File "/home/stowers/.virtualenvs/opencv3/local/lib/python2.7/site-packages/pytest_benchmark/plugin.py", line 46, in import statistics ImportError: No module named statistics

maybe pytest-benchmark should install it if missing?

ionelmc commented 9 years ago

pip should do that, hmmm

can you paste some install logs? (eg: pip install pytest-benchmark)

nzjrs commented 9 years ago
mkvirtualenv --system-site-packages hate
pip install --upgrade pytest-benchmark[histogram]
Downloading/unpacking pytest-benchmark[histogram]
  Downloading pytest-benchmark-3.0.0rc1.tar.gz (333Kb): 333Kb downloaded
  Running setup.py egg_info for package pytest-benchmark

    warning: no directories found matching 'examples'
    warning: no files found matching '.isort.cfg'
    warning: no files found matching '.pylintrc'
    warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    warning: no previously-included files matching '*.dylib' found anywhere in distribution
  Installing extra requirements: 'histogram'
Downloading/unpacking pytest>=2.6 (from pytest-benchmark[histogram])
  Downloading pytest-2.8.2.tar.gz (563Kb): 563Kb downloaded
  Running setup.py egg_info for package pytest

Downloading/unpacking pygal (from pytest-benchmark[histogram])
  Downloading pygal-2.0.8.tar.gz (66Kb): 66Kb downloaded
  Running setup.py egg_info for package pygal

Downloading/unpacking pygaljs (from pytest-benchmark[histogram])
  Downloading pygaljs-1.0.1.tar.gz (84Kb): 84Kb downloaded
  Running setup.py egg_info for package pygaljs

    warning: no directories found matching 'docs'
    warning: no directories found matching 'examples'
    warning: no directories found matching 'ci'
    warning: no files found matching '.coveragerc'
    warning: no files found matching '.cookiecutterrc'
    warning: no files found matching '.isort.cfg'
    warning: no files found matching '.pylintrc'
    warning: no files found matching 'AUTHORS.rst'
    warning: no files found matching 'CONTRIBUTING.rst'
    warning: no files found matching '.travis.yml'
    warning: no files found matching 'appveyor.yml'
    warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    warning: no previously-included files matching '*.dylib' found anywhere in distribution
Downloading/unpacking py>=1.4.29 (from pytest>=2.6->pytest-benchmark[histogram])
  Downloading py-1.4.30.tar.gz (191Kb): 191Kb downloaded
  Running setup.py egg_info for package py

Installing collected packages: pytest-benchmark, pytest, pygal, pygaljs, py
  Running setup.py install for pytest-benchmark

    warning: no directories found matching 'examples'
    warning: no files found matching '.isort.cfg'
    warning: no files found matching '.pylintrc'
    warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    warning: no previously-included files matching '*.dylib' found anywhere in distribution
  Running setup.py install for pytest

    Installing py.test script to /home/stowers/.virtualenvs/hate/bin
    Installing py.test-2.7 script to /home/stowers/.virtualenvs/hate/bin
  Running setup.py install for pygal
    changing mode of build/scripts-2.7/pygal_gen.py from 664 to 775

    changing mode of /home/stowers/.virtualenvs/hate/bin/pygal_gen.py to 775
  Running setup.py install for pygaljs

    warning: no directories found matching 'docs'
    warning: no directories found matching 'examples'
    warning: no directories found matching 'ci'
    warning: no files found matching '.coveragerc'
    warning: no files found matching '.cookiecutterrc'
    warning: no files found matching '.isort.cfg'
    warning: no files found matching '.pylintrc'
    warning: no files found matching 'AUTHORS.rst'
    warning: no files found matching 'CONTRIBUTING.rst'
    warning: no files found matching '.travis.yml'
    warning: no files found matching 'appveyor.yml'
    warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    warning: no previously-included files matching '*.dylib' found anywhere in distribution
  Found existing installation: py 1.3.4
    Not uninstalling py at /usr/lib/pymodules/python2.7, outside environment /home/stowers/.virtualenvs/hate
  Running setup.py install for py

Successfully installed pytest-benchmark pytest pygal pygaljs py
Cleaning up..
$ py.test

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 WARNING: Benchmarks are automatically disabled because we could not import `statistics`

Traceback (most recent call last):
  File "/home/stowers/.virtualenvs/hate/local/lib/python2.7/site-packages/pytest_benchmark/plugin.py", line 46, in <module>
    import statistics
ImportError: No module named statistics
ionelmc commented 9 years ago

Do you happen to use a very old pip (that don't support environment markers)?

ionelmc commented 9 years ago

I think pip < 6.0 is not going to correctly install that dep - you need to manually specify it (pip install statistics). Or just upgrade pip (better)