ImportError: DLL load failed while importing lib with importing syft in vscode

4.4k Views Asked by At

I create a new environment (my_syft env) with conda and python 3.9.7 and install syft 0.5.0.

Then I check the installation of my module and it's seem that the installations pass correctly

C:\Users\tamir>conda activate my_syft_env
        
(my_syft_env) C:\Users\tamir>python
Python 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import syft
>>>
>>> import sys
>>> print(sys.executable)
C:\Users\tamir\anaconda3\envs\my_syft_env\python.exe
>>> 

Then in try to run and check my module in VScode and choose the current environment C:\Users\tamir\anaconda3\envs\my_syft_env\python.exe

import syft
print("hellow")

but get en error

Traceback (most recent call last):
  File "c:\Users\tamir\Desktop\TAMIR\pyton vscode\federated.py", line 1, in <module>
    import syft
  File "C:\Users\tamir\anaconda3\lib\site-packages\syft\__init__.py", line 48, in <module>
    from syft.core.node.device.device import Device  # noqa: F401
  File "C:\Users\tamir\anaconda3\lib\site-packages\syft\core\node\device\__init__.py", line 2, in <module>
    from .client import DeviceClient
  File "C:\Users\tamir\anaconda3\lib\site-packages\syft\core\node\device\client.py", line 16, in <module>
    from ..common.client import Client
  File "C:\Users\tamir\anaconda3\lib\site-packages\syft\core\node\common\client.py", line 18, in <module>
    from ....lib import create_lib_ast
  File "C:\Users\tamir\anaconda3\lib\site-packages\syft\lib\__init__.py", line 28, in <module>
    from ..lib.torch import create_torch_ast
  File "C:\Users\tamir\anaconda3\lib\site-packages\syft\lib\torch\__init__.py", line 12, in <module>
    from . import parameter  # noqa: 401
  File "C:\Users\tamir\anaconda3\lib\site-packages\syft\lib\torch\parameter.py", line 9, in <module>
    from ...lib.torch.tensor_util import tensor_deserializer
  File "C:\Users\tamir\anaconda3\lib\site-packages\syft\lib\torch\tensor_util.py", line 2, in <module>
    import pyarrow as pa
  File "C:\Users\tamir\anaconda3\lib\site-packages\pyarrow\__init__.py", line 63, in <module>
    import pyarrow.lib as _lib
ImportError: DLL load failed while importing lib: The specified procedure could not be found.

I dont know why there is an error.

2

There are 2 best solutions below

0
On

I may be late, but to paraphrase this thread, you might have installed libboost and boost-cpp from the default conda channels. Try the following:

  • conda install libboost boost-cpp -c conda-forge
  • If on a Windows machine, make sure you have Visual C++ Redistributables 2019 or later.
  • See if the pip version of pyarrow works.
0
On

I had the same problem, on windows with python 3.10, and which I solved as follows:

  1. upgrade pip:

python -m pip install --upgrade pip

  1. install/upgrade pyarrow:

pip install --upgrade pyarrow