Cannot import opendp.smartnoise.core using Azure ML Notebooks , OSError: ... cannot open shared object file: No such file or directory

HASLEHNER, MYLENE 30 Reputation points
2023-06-13T15:22:37.8466667+00:00

I have a Mac with M1. When I try to follow the instructions of the notebook exercise "Explore Differential Privacy" and execute the command

import opendp.smartnoise.core as sn

I get the following error:

--------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[10], line 1
----> 1 import opendp.smartnoise.core as sn

File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/opendp/smartnoise/core/__init__.py:1
----> 1 from .base import *
      3 # The full namespace is used because the file location comes from an external script
      4 # components.py is generated from scripts/code_generation.py
      5 # in opendifferentialprivacy/smartnoise-core-python
      6 from opendp.smartnoise.core.components import *

File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/opendp/smartnoise/core/base.py:11
      7 import typing
      9 from opendp.smartnoise.core import api_pb2, value_pb2, base_pb2
---> 11 core_library = LibraryWrapper()
     13 # All available extensions for arguments (data_rows, left_lower, etc)
     14 ALL_CONSTRAINTS = ["n", "rows", "columns", "lower", "upper", "categories"]

File /anaconda/envs/azureml_py38/lib/python3.8/site-packages/opendp/smartnoise/core/api.py:30, in LibraryWrapper.__init__(self)
     27 lib_dir = os.path.join(script_dir, "lib")
     28 lib_smartnoise_path = os.path.join(lib_dir, f"{prefix}smartnoise_ffi{extension}")
---> 30 self.lib_smartnoise = ctypes.cdll.LoadLibrary(lib_smartnoise_path)
     32 proto_argtypes = [ctypes.POINTER(ctypes.c_ubyte), ctypes.c_int32]
     34 class ByteBuffer(ctypes.Structure):

File /anaconda/envs/azureml_py38/lib/python3.8/ctypes/__init__.py:459, in LibraryLoader.LoadLibrary(self, name)
    458 def LoadLibrary(self, name):
--> 459     return self._dlltype(name)

File /anaconda/envs/azureml_py38/lib/python3.8/ctypes/__init__.py:381, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    378 self._FuncPtr = _FuncPtr
    380 if handle is None:
--> 381     self._handle = _dlopen(self._name, mode)
    382 else:
    383     self._handle = handle

OSError: /anaconda/envs/azureml_py38/lib/python3.8/site-packages/opendp/smartnoise/core/lib/libsmartnoise_ffi.so: cannot open shared object file: No such file or directory


although installing opendp-smartnoise worked fine:

pip install opendp-smartnoise==0.1.4.2

Requirement already satisfied: charset-normalizer<4,>=2 in /anaconda/envs/azureml_py38/lib/python3.8/site-packages

What is wrong and what can I do? (Restarting the kernel did not work)

Thanks!

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

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.