Python API call failed in Azure Machine Learning

Anonymous
2023-09-28T14:22:21.5566667+00:00

Hello, I'm working on a notebook in azure machine learning.

I need to do a pip install, so I did :

!pip install azureml

However here's the error I get :

ImportError: /anaconda/envs/azureml_py38/lib/python3.8/site-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so: undefined symbol: ffi_type_uint32, version LIBFFI_BASE_7.0
thread '<unnamed>' panicked at 'Python API call failed', /croot/cryptography_1694444244250/_build_env/.cargo.Linux/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.18.3/src/err/mod.rs:790:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "/anaconda/envs/azureml_py38/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 73, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 104, in create_command
    module = importlib.import_module(module_path)
  File "/anaconda/envs/azureml_py38/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 24, in <module>
    from pip._internal.cli.req_command import RequirementCommand, with_cleanup
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 16, in <module>
    from pip._internal.index.package_finder import PackageFinder
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/pip/_internal/index/package_finder.py", line 21, in <module>
    from pip._internal.index.collector import parse_links
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/pip/_internal/index/collector.py", line 14, in <module>
    from pip._vendor import html5lib, requests
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/pip/_vendor/requests/__init__.py", line 97, in <module>
    from pip._vendor.urllib3.contrib import pyopenssl
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import SSL, crypto
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/OpenSSL/SSL.py", line 9, in <module>
    from OpenSSL._util import (
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 15, in <module>
    from cryptography.exceptions import InternalError
  File "/anaconda/envs/azureml_py38/lib/python3.8/site-packages/cryptography/exceptions.py", line 9, in <module>
    from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions
pyo3_runtime.PanicException: Python API call failed

I tried to find a solution. It seems this error happens because of an error related to a kernel.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,891 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. romungi-MSFT 45,961 Reputation points Microsoft Employee
    2023-09-29T07:50:03.5733333+00:00

    @Anonymous It looks like something is wrong with your environment and the required packages for SDK v1 are not installed in your current environment for the selected kernel version. Here is what I would suggest before trying again.

    1. Restart your compute instance or kernel
    2. Select the required kernel for the notebook
    3. Install the SDK package using %pip install <package>
    4. Follow the steps here to install required components of the SDK

    The basic components of azure ml SDK v1 required package azureml-core, try to install every required component and use %pip show or %pip list to confirm the installation and then proceed running your experiments. Thanks!!

    %pip install --upgrade azureml-core

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

  2. Gülşah Kılıç 0 Reputation points
    2024-03-22T06:53:14.1133333+00:00

    Hello, I have the same problem. how did you fix it?Lucas Colas

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.