Coremltools: ModuleNotFoundError using coremltools 4.0b3

Created on 19 Aug 2020  路  8Comments  路  Source: apple/coremltools

馃悶Describe the bug

Importing coremltools in the new 4.0b3 release causes a ModuleNotFoundError.

Trace

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    import coremltools as ct
  File "env/lib/python3.7/site-packages/coremltools/__init__.py", line 54, in <module>
    from . import converters
  File "env/lib/python3.7/site-packages/coremltools/converters/__init__.py", line 7, in <module>
    from . import libsvm
  File "env/lib/python3.7/site-packages/coremltools/converters/libsvm/__init__.py", line 8, in <module>
    from . import _libsvm_converter
  File "env/lib/python3.7/site-packages/coremltools/converters/libsvm/_libsvm_converter.py", line 7, in <module>
    from ..._deps import _HAS_LIBSVM
  File "env/lib/python3.7/site-packages/coremltools/_deps/__init__.py", line 15, in <module>
    from packaging import version
ModuleNotFoundError: No module named 'packaging'

To Reproduce

  • If a python script can reproduce the error, please paste the code snippet
virtualenv env
source env/bin/activate
pip install coremltools-4.0b3-cp37-none-macosx_10_15_intel.whl

In main.py:

import coremltools as ct

The ModuleNotFoundError occurs when importing coremltools.

System environment (please complete the following information):

  • coremltools version (e.g., 3.0b5): 4.0b3
  • OS (e.g., MacOS, Linux): masOS
  • macOS version (if applicable): 10.15.6
  • XCode version (if applicable): N/A
  • How you install python (anaconda, virtualenv, system): virtualenv
  • python version (e.g. 3.7): 3.7.5
  • any other relevant information: None

Additional context

This problem does not happen with the 4.0b2 wheel, only the 4.0b3 wheel.

bug

Most helpful comment

@willbattel installing packaging module resolve this. We will add this as a dependency

All 8 comments

@willbattel installing packaging module resolve this. We will add this as a dependency

@srikris Can you add packaging module dependency to setup.py?
packaging module is used in https://github.com/apple/coremltools/blob/94737631ebef98fddd9351057bfc4f2f8f626349/coremltools/_deps/__init__.py#L15

@srikris Can you add packaging module dependency to setup.py?
packaging module is used in

https://github.com/apple/coremltools/blob/94737631ebef98fddd9351057bfc4f2f8f626349/coremltools/_deps/__init__.py#L15

Will make sure to include this in next release, thanks!

what should I do before this gets fixed?

Is there a manual way too add the dependancy of packaging as an work around. I am running 4.0b3 and would like to be able to import coremltools.

what should I do before this gets fixed?

Is there a manual way too add the dependancy of packaging as an work around. I am running 4.0b3 and would like to be able to import coremltools.

You can install packaging yourself. For example, if using pip, simply pip install packaging.

thanks and that worked

This issue has been fixed and will include in the next release. Thanks!

Fixed with coremltools 4.0b4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

haifengkao picture haifengkao  路  4Comments

wschin picture wschin  路  4Comments

zantism picture zantism  路  5Comments

ghost picture ghost  路  3Comments

skymaze picture skymaze  路  5Comments