roboflow / inference

A fast, easy-to-use, production-ready inference server for computer vision supporting deployment of many popular model architectures and fine-tuned models.
https://inference.roboflow.com
Other
1.15k stars 85 forks source link

Failed to install inference package ! Error "AttributeError: module 'pkgutil' has no attribute 'ImpImporter'" #370

Closed sridharreddyu closed 2 months ago

sridharreddyu commented 2 months ago

Search before asking

Bug

I am trying to install the inference package in my Mac M1 Pro, OS Sonoma. But got the below error

Collecting inference
  Using cached inference-0.9.17-py3-none-any.whl.metadata (14 kB)
Collecting APScheduler<=3.10.1 (from inference)
  Using cached APScheduler-3.10.1-py3-none-any.whl.metadata (5.7 kB)
Collecting cython<=3.0.0 (from inference)
  Using cached Cython-3.0.0-py2.py3-none-any.whl.metadata (3.1 kB)
Requirement already satisfied: python-dotenv<=2.0.0 in ./anaconda3/envs/aws_bedrock_env/lib/python3.12/site-packages (from inference) (1.0.1)
Collecting fastapi<1.0,>=0.100 (from inference)
  Using cached fastapi-0.110.3-py3-none-any.whl.metadata (24 kB)
Collecting numpy<=1.25.2 (from inference)
  Using cached numpy-1.25.2.tar.gz (10.8 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      Traceback (most recent call last):
        File "/Users/sridharreddyu/anaconda3/envs/aws_bedrock_env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/sridharreddyu/anaconda3/envs/aws_bedrock_env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/sridharreddyu/anaconda3/envs/aws_bedrock_env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
          backend = _build_backend()
                    ^^^^^^^^^^^^^^^^
        File "/Users/sridharreddyu/anaconda3/envs/aws_bedrock_env/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
          obj = import_module(mod_path)
                ^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/sridharreddyu/anaconda3/envs/aws_bedrock_env/lib/python3.12/importlib/__init__.py", line 90, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
        File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 995, in exec_module
        File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
        File "/private/var/folders/vv/p9_n37s144z0z6sjr_gm9bqc0000gn/T/pip-build-env-pmv9s8dx/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
          import setuptools.version
        File "/private/var/folders/vv/p9_n37s144z0z6sjr_gm9bqc0000gn/T/pip-build-env-pmv9s8dx/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
          import pkg_resources
        File "/private/var/folders/vv/p9_n37s144z0z6sjr_gm9bqc0000gn/T/pip-build-env-pmv9s8dx/overlay/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2172, in <module>
          register_finder(pkgutil.ImpImporter, find_on_path)
                          ^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Environment

Minimal Reproducible Example

No response

Additional

I am following the instructions specified in the website: roboflow web site link

Are you willing to submit a PR?

grzegorz-roboflow commented 2 months ago

Hi @sridharreddyu, thank you for submitting bug report! Can you share what was the python version you tried to install inference with? Unfortunately Python 3.12 is not yet supported, but installing with older version (i.e. Python 3.8) works fine for me.

sridharreddyu commented 2 months ago

Hi,

Thank you for reverting back quickly. As you suggested, I will try with 3.8 and let you know.

I have a 3.9 python version.

% python --version Python 3.9.13

On Tue, Apr 30, 2024 at 3:08 PM Grzegorz Klimaszewski < @.***> wrote:

Hi @sridharreddyu https://github.com/sridharreddyu, thank you for submitting bug report! Can you share what was the python version you tried to install inference with? Unfortunately Python 3.12 is not yet supported, but installing with older version (i.e. Python 3.8) works fine for me.

— Reply to this email directly, view it on GitHub https://github.com/roboflow/inference/issues/370#issuecomment-2084839231, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC7EMSXZ6EQIFROJDZ52AWTY75RANAVCNFSM6AAAAABG7RI3YWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBUHAZTSMRTGE . You are receiving this because you were mentioned.Message ID: @.***>

grzegorz-roboflow commented 2 months ago

I tried python3.9 and can install inference in my venv without encountering errors:

python3.9 -m venv venv
source venv/bin/activate
python --version
# yields Python 3.9.19
pip install inference

Can you share your installation steps?

sridharreddyu commented 2 months ago

Hi Again,

With the fresh python environment from my macbook terminal and with your commands, I am able to install it.

Earlier I was trying to install it from the VSCode Notebook existing python environment. Here is the screenshot of it. Maybe It was clashing with other dependencies, I will try with a fresh environment from my VSCode Notebook and come back to you. [image: Screenshot 2024-05-02 at 4.47.08 PM.png]

On Tue, Apr 30, 2024 at 4:25 PM Grzegorz Klimaszewski < @.***> wrote:

I tried python3.9 and can install inference in my venv without encountering your error:

python3.9 -m venv venvsource venv/bin/activate pip install inference

Can you share your installation steps?

— Reply to this email directly, view it on GitHub https://github.com/roboflow/inference/issues/370#issuecomment-2084987197, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC7EMSQZ2Q3BFN3AYLPG57TY752AVAVCNFSM6AAAAABG7RI3YWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBUHE4DOMJZG4 . You are receiving this because you were mentioned.Message ID: @.***>

grzegorz-roboflow commented 2 months ago

Hi @sridharreddyu , I'm glad your issue is resolved! I'll close this issue, please feel free to open another if you need more help.