COMET: COMET not working with python 3.8

πŸ› Bug

COMET works with python 3.6 but not with python 3.8

Environment

OS: MacOS Packaging: pip Version 1.0.0rc6

To Reproduce

I pip installed comet on my python 3.8.12 virtual environment and then tested the example provided in the readme Scoring with Python

seg_scores, sys_score = model.predict(data, batch_size=8, gpus=0)

But I get the following error:

/usr/local/Cellar/python@3.8/3.8.12/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/popen_spawn_posix.py in _launch(self, process_obj)
     45         try:
     46             reduction.dump(prep_data, fp)
---> 47             reduction.dump(process_obj, fp)
     48         finally:
     49             set_spawning_popen(None)

/usr/local/Cellar/python@3.8/3.8.12/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/reduction.py in dump(obj, file, protocol)
     58 def dump(obj, file, protocol=None):
     59     '''Replacement for pickle.dump() using ForkingPickler.'''
---> 60     ForkingPickler(file, protocol).dump(obj)
     61 
     62 #

AttributeError: Can't pickle local object 'CometModel.predict.<locals>.<lambda>'

I tested the same code on python 3.6 and it did work, so thanks a lot πŸ˜ƒ

I expected comet to work with >=python3.5 Is there any plan to make it work for python 3.8?

Thanks again.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (10 by maintainers)

Commits related to this issue

Most upvoted comments

It still doesn’t work for Python 3.8…

Thanks a lot @ricardorei . It works perfectly!

I am getting the same error with Python 3.11.8:

Traceback (most recent call last):
  File "/home/souto/Repos/msoutopico/python-comet/code/main.py", line 2, in <module>
    from comet import download_model, load_from_checkpoint
ImportError: cannot import name 'download_model' from 'comet' (/home/souto/.cache/pypoetry/virtualenvs/python-comet-nDgw5fZj-py3.11/lib/python3.11/site-packages/comet/__init__.py)

I got this error 2 days ago and realized the PyPi package I had installed was https://pypi.org/project/Comet/ and not https://pypi.org/project/unbabel-comet/. Uninstalling the Comet and installing the unbabel-comet package solved it in my case, hope it does for yours as well !

@AnanyaCoder the same error occours in my python3.7 env, have you figured it out?

Yes, it works (with a few command-line parameter changes). Thank you!