简体   繁体   中英

Python import simple_salesforce in Databricks gives: No module named cryptography.hazmat.primitives.asymmetric.ed25519

I'm trying to use Azure Databricks to launch Python script that imports the library: "simple_salesforce"

I have installed the library as shown on the picture bellow, please note that while installing the library the name should be "simple-salesforce" and while importing it "simple_salesforce" (just to mention that I didn't mistaken the name): Installation of the library

As shown on the picture bellow, the library was installed successfully: simple-salesforce installed

When try to import it in my workspace, using:

import simple_salesforce

I get the following error (see the error picture bellow):

ImportError: No module named 'cryptography.hazmat.primitives.asymmetric.ed25519'

Error

I've tried to install the "cryptography" library with the same method I used to install the other libraries (see the picture bellow), but I still get the same error: cryptography

Is there any step that I missed?

Best regards,

You don't have the library "cryptography" installed. It is very likely that you are using a Databricks runtime version of 5.5 LTS or less, with one worker.

The problem is that you have a Databricks cluster with Python3 and the notebook is running on a Python2 kernel.

Method 1

Check if you have python 3:

%sh
python3 --version

Then install pip3:

%sh
sudo apt install python3-pip

After that you can install "cryptography"

Method 2

I highly recommand this method, which consists of using 7.4 Databricks Runtime version with a minimum of 2 workers, then you will have python3 and the library "cryptography" installed by default.

You will just need to install simple-salesforce manually from the libraries part, and:

import simple_salesforce

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM