rasbt / pyprind

PyPrind - Python Progress Indicator Utility
BSD 3-Clause "New" or "Revised" License
547 stars 65 forks source link

psutil requirement #28

Closed cardosan closed 8 years ago

cardosan commented 8 years ago

HI, I am working with a package that uses pyprind and seems that there is a prob with psutil. Also doing

pip install pyprind -r requirements.txt
Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'

looks like there is no 'requirements.txt' and this prevents pyprind to work


bw2setup()
bw2setup()
Creating default biosphere

Writing activities to SQLite3 database:
Applying strategy: normalize_units
Applying strategy: drop_unspecified_subcategories
Applied 2 strategies in 0.01 seconds
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-5-c9438012d7c9> in <module>()
----> 1 bw2setup()

/home/giuseppe/miniconda2/envs/bw2/lib/python3.4/site-packages/bw2io/__init__.py in bw2setup()
     90         return
     91     print("Creating default biosphere\n")
---> 92     create_default_biosphere3()
     93     print("Creating default LCIA methods\n")
     94     create_default_lcia_methods()

/home/giuseppe/miniconda2/envs/bw2/lib/python3.4/site-packages/bw2io/__init__.py in create_default_biosphere3()
     77     eb = Ecospold2BiosphereImporter()
     78     eb.apply_strategies()
---> 79     eb.write_database()
     80 
     81 def create_default_lcia_methods():

/home/giuseppe/miniconda2/envs/bw2/lib/python3.4/site-packages/bw2io/importers/base_lci.py in write_database(self, data, name, overwrite, backend, **kwargs)
     96         data = {(ds['database'], ds['code']): ds for ds in data}
     97         existing.update(data)
---> 98         db.write(existing)
     99         print("Created database: {}".format(db.name))
    100         return db

/home/giuseppe/miniconda2/envs/bw2/lib/python3.4/site-packages/bw2data/project.py in writable_project(wrapped, instance, args, kwargs)
    316     if projects.read_only:
    317         raise ReadOnlyProject(READ_ONLY_PROJECT)
--> 318     return wrapped(*args, **kwargs)

/home/giuseppe/miniconda2/envs/bw2/lib/python3.4/site-packages/bw2data/backends/peewee/database.py in write(self, data, process)
    228         if data:
    229             try:
--> 230                 self._efficient_write_many_data(data)
    231             except:
    232                 # Purge all data from database, then reraise

/home/giuseppe/miniconda2/envs/bw2/lib/python3.4/site-packages/bw2data/backends/peewee/database.py in _efficient_write_many_data(self, data, indices)
    150                     len(data),
    151                     title="Writing activities to SQLite3 database:",
--> 152                     monitor=True
    153                 )
    154 

/home/giuseppe/miniconda2/envs/bw2/lib/python3.4/site-packages/pyprind/progbar.py in __init__(self, iterations, track_time, width, bar_char, stream, title, monitor, update_interval)
     46                  stream=2, title='', monitor=False, update_interval=None):
     47         Prog.__init__(self, iterations, track_time,
---> 48                       stream, title, monitor, update_interval)
     49         self.bar_width = width
     50         self._adjust_width()

/home/giuseppe/miniconda2/envs/bw2/lib/python3.4/site-packages/pyprind/prog_class.py in __init__(self, iterations, track_time, stream, title, monitor, update_interval)
     42 
     43         if self.monitor:
---> 44             import psutil
     45             self.process = psutil.Process()
     46         if self.track:

ImportError: No module named 'psutil'
rasbt commented 8 years ago

Sorry for the trouble and thanks for the note! I will add the requirements file later today! In any case, until the new version is uploaded to pip, a

pip install psutil
pip install pyprind

should fix the problem!

cardosan commented 8 years ago

thanks!

rasbt commented 8 years ago

I just added the requirements.txt. However, I guess that it would only work locally not via PyPI. I don't want to make psutils a hard requirement via install_requires in the setup.py or so, because it's just an optional package for the non-default monitor=True in pyprind