Connect Python, Javascript and Micropython based devices to Arduino Cloud

Hi!

We are really excited to announce that now it is possible to connect seamlessly to the IoT Cloud devices that use Python, Micropython and Javascript. This can be done using the new "Manual Setup Device" workflow that can be triggered when Adding a new Device.

You can read the full story here or check the article in the documentation to learn how to get started.

Your feedback is highly appreciated, so please, share with us your projects, improvement ideas, etc.

This looks to be a great upgrade, but I'm having trouble getting it going. In the first instance I thought I'd give this a test drive with my Windows laptop running Python 3.11.4. I tried to load the Python package using the suggested "pip install arduino-iot-cloud-py" but got the error message below. Any ideas as to what the problem might be?

ERROR: Could not find a version that satisfies the requirement arduino-iot-cloud-py (from versions: none)
ERROR: No matching distribution found for arduino-iot-cloud-py

Hi @robertics. It looks like there is an error in the documentation. The package name is arduino_iot_cloud, not arduino-iot-cloud-py. So you should use this command:

pip install arduino_iot_cloud

That got me a lot closer, but I think there is a dependency issue. Simply running

pip install arduino_iot_cloud

Raises an error:

Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting arduino_iot_cloud
  Downloading https://www.piwheels.org/simple/arduino-iot-cloud/arduino_iot_cloud-0.0.7-py3-none-any.whl (19 kB)
Collecting cbor2>=5.4.6 (from arduino_iot_cloud)
  Using cached cbor2-5.4.6-py3-none-any.whl (19 kB)
Collecting M2Crypto>=0.38.0 (from arduino_iot_cloud)
  Using cached M2Crypto-0.38.0.tar.gz (1.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting micropython-senml>=0.1.0 (from arduino_iot_cloud)
  Using cached micropython_senml-0.1.0-py2.py3-none-any.whl (10 kB)
Building wheels for collected packages: M2Crypto
  Building wheel for M2Crypto (pyproject.toml) ... error
  error: subprocess-exited-with-error

  Γ— Building wheel for M2Crypto (pyproject.toml) did not run successfully.
  β”‚ exit code: 1
  ╰─> [60 lines of output]
      INFO:run_command:running bdist_wheel
      INFO:run_command:running build
      INFO:run_command:running build_py
      INFO:copy_file:copying src/M2Crypto/threading.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/RC4.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/X509.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/Err.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/six.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/util.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/ASN1.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/m2urllib.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/httpslib.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/callback.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/m2urllib2.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/RSA.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/AuthCookie.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/Engine.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/Rand.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/ftpslib.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/m2xmlrpclib.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/EVP.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/DSA.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/DH.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/__init__.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/m2.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/BIO.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/SMIME.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/m2crypto.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/BN.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:copy_file:copying src/M2Crypto/EC.py -> build/lib.linux-armv7l-cpython-38/M2Crypto
      INFO:mkpath:creating build/lib.linux-armv7l-cpython-38/M2Crypto/SSL
      INFO:copy_file:copying src/M2Crypto/SSL/cb.py -> build/lib.linux-armv7l-cpython-38/M2Crypto/SSL
      INFO:copy_file:copying src/M2Crypto/SSL/Context.py -> build/lib.linux-armv7l-cpython-38/M2Crypto/SSL
      INFO:copy_file:copying src/M2Crypto/SSL/timeout.py -> build/lib.linux-armv7l-cpython-38/M2Crypto/SSL
      INFO:copy_file:copying src/M2Crypto/SSL/Cipher.py -> build/lib.linux-armv7l-cpython-38/M2Crypto/SSL
      INFO:copy_file:copying src/M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-armv7l-cpython-38/M2Crypto/SSL
      INFO:copy_file:copying src/M2Crypto/SSL/Session.py -> build/lib.linux-armv7l-cpython-38/M2Crypto/SSL
      INFO:copy_file:copying src/M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-armv7l-cpython-38/M2Crypto/SSL
      INFO:copy_file:copying src/M2Crypto/SSL/Checker.py -> build/lib.linux-armv7l-cpython-38/M2Crypto/SSL
      INFO:copy_file:copying src/M2Crypto/SSL/Connection.py -> build/lib.linux-armv7l-cpython-38/M2Crypto/SSL
      INFO:copy_file:copying src/M2Crypto/SSL/__init__.py -> build/lib.linux-armv7l-cpython-38/M2Crypto/SSL
      INFO:copy_file:copying src/M2Crypto/SSL/SSLServer.py -> build/lib.linux-armv7l-cpython-38/M2Crypto/SSL
      INFO:run_command:running egg_info
      INFO:write_pkg_info:writing src/M2Crypto.egg-info/PKG-INFO
      INFO:write_file:writing dependency_links to src/M2Crypto.egg-info/dependency_links.txt
      INFO:write_file:writing top-level names to src/M2Crypto.egg-info/top_level.txt
      INFO:read_manifest:reading manifest file 'src/M2Crypto.egg-info/SOURCES.txt'
      INFO:read_template:reading manifest template 'MANIFEST.in'
      WARNING:process_template_line:warning: no files found matching 'SWIG/*.i'
      WARNING:process_template_line:warning: no files found matching 'SWIG/*.h'
      WARNING:process_template_line:warning: no files found matching 'SWIG/*.def'
      WARNING:process_template_line:warning: no files found matching 'SWIG/_m2crypto_wrap.c'
      WARNING:process_template_line:warning: no files found matching 'M2Crypto/m2crypto.py'
      INFO:add_license_files:adding license file 'LICENCE'
      INFO:execute:writing manifest file 'src/M2Crypto.egg-info/SOURCES.txt'
      INFO:run_command:running build_ext
      INFO:build_extension:building 'M2Crypto._m2crypto' extension
      INFO:swig_sources:swigging src/SWIG/_m2crypto.i to src/SWIG/_m2crypto_wrap.c
      INFO:spawn:swig -python -py3 -I/usr/lib/gcc/arm-linux-gnueabihf/8/include -I/usr/local/include -I/usr/lib/gcc/arm-linux-gnueabihf/8/include-fixed -I/usr/include/arm-linux-gnueabihf -I/usr/include -D__armv7l__ -I/usr/include/python3.8 -I/usr/include/openssl -includeall -modern -builtin -outdir /tmp/pip-install-wy38qd7i/m2crypto_5afbae439c774477820194e58f4cedee/src/M2Crypto -o src/SWIG/_m2crypto_wrap.c src/SWIG/_m2crypto.i
      error: command 'swig' failed: No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for M2Crypto
Failed to build M2Crypto
ERROR: Could not build wheels for M2Crypto, which is required to install pyproject.toml-based projects

So I then ran pip install swig which tried to load, but also failed indicating that it can't find swig.

> pip install swig                
Collecting swig
  Downloading swig-4.1.1-py2.py3-none-win_amd64.whl (2.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 MB 5.8 MB/s eta 0:00:00
Installing collected packages: swig
Successfully installed swig-4.1.1
(study_session) PS C:\Users\robsm\OneDrive\Documents\Proj\Python_VS\numpy5> pip install arduino-iot-cloud   
Collecting arduino-iot-cloud
  Using cached arduino_iot_cloud-0.0.7-py3-none-any.whl (19 kB)
Collecting cbor2>=5.4.6 (from arduino-iot-cloud)
  Using cached cbor2-5.4.6-cp311-cp311-win_amd64.whl (59 kB)
Collecting M2Crypto>=0.38.0 (from arduino-iot-cloud)
  Using cached M2Crypto-0.38.0.tar.gz (1.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting micropython-senml>=0.1.0 (from arduino-iot-cloud)
  Using cached micropython_senml-0.1.0-py2.py3-none-any.whl (10 kB)
Building wheels for collected packages: M2Crypto
  Building wheel for M2Crypto (pyproject.toml) ... error
  error: subprocess-exited-with-error

  Γ— Building wheel for M2Crypto (pyproject.toml) did not run successfully.
  β”‚ exit code: 1
  ╰─> [65 lines of output]
      INFO:run_command:running bdist_wheel
      INFO:run_command:running build
      INFO:run_command:running build_py
      INFO:copy_file:copying src\M2Crypto\ASN1.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\AuthCookie.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\BIO.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\BN.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\callback.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\DH.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\DSA.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\EC.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\Engine.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\Err.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\EVP.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\ftpslib.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\httpslib.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\m2.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\m2crypto.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\m2urllib.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\m2urllib2.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\m2xmlrpclib.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\Rand.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\RC4.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\RSA.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\six.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\SMIME.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\threading.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\util.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\X509.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\__init__.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:mkpath:creating build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\cb.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\Checker.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\Cipher.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\Connection.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\Context.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\Session.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\SSLServer.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\ssl_dispatcher.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\timeout.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\TwistedProtocolWrapper.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\__init__.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:run_command:running egg_info
      INFO:write_pkg_info:writing src\M2Crypto.egg-info\PKG-INFO
      Traceback (most recent call last):
        File "<frozen runpy>", line 198, in _run_module_as_main
        File "<frozen runpy>", line 88, in _run_code
        File "C:\Users\robsm\OneDrive\Documents\Proj\Python_VS\numpy5\study_session\Scripts\swig.exe\__main__.py", line 4, in <module>
      ModuleNotFoundError: No module named 'swig'
      error: command 'C:\\Users\\robsm\\OneDrive\\Documents\\Proj\\Python_VS\\numpy5\\study_session\\Scripts\\swig.exe' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for M2Crypto
Failed to build M2Crypto
ERROR: Could not build wheels for M2Crypto, which is required to install pyproject.toml-based projects

On a Raspberry Pi 3B+ with Python 3.8.0 swig installed ok, but pip install arduino-iot-cloud returned an error that it couldn't find swig.

      .
      .
      .
      INFO:run_command:running build_ext
      INFO:build_extension:building 'M2Crypto._m2crypto' extension
      INFO:swig_sources:swigging src/SWIG/_m2crypto.i to src/SWIG/_m2crypto_wrap.c
      INFO:spawn:swig -python -py3 -I/usr/lib/gcc/arm-linux-gnueabihf/8/include -I/usr/local/include -I/usr/lib/gcc/arm-linux-gnueabihf/8/include                               -fixed -I/usr/include/arm-linux-gnueabihf -I/usr/include -D__armv7l__ -I/usr/include/python3.8 -I/usr/include/openssl -includeall -modern -builti                               n -outdir /tmp/pip-install-2krjj2n_/m2crypto_6f8591b8ecb14b26bf178bf52f69d7da/src/M2Crypto -o src/SWIG/_m2crypto_wrap.c src/SWIG/_m2crypto.i
      Traceback (most recent call last):
        File "/home/pi/.local/bin/swig", line 5, in <module>
          from swig import swig
      ModuleNotFoundError: No module named 'swig'
      error: command '/home/pi/.local/bin/swig' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for M2Crypto
Failed to build M2Crypto
ERROR: Could not build wheels for M2Crypto, which is required to install pyproject.toml-based projects

But swig is on the path

pi@Hub:~ $ which swig
/home/pi/.local/bin/swig

To be clear I ran:

pip install arduino-iot-cloud       [It failed to install]
pip install swig                    [It installed ok]
pip install arduino-iot-cloud       [It still failed to install]

@robertics, I tried the same but then downloaded swig and manually added it to the path on my Windows machine. I downloaded the zip from Download swigwin-4.1.1.zip (SWIG).
That got a little further once I did but then it failed on

      Deprecated command line option: -py3. Ignored, this option is no longer supported.
      Deprecated command line option: -modern. Ignored, this option is now always on.
      src\SWIG\_m2crypto.i(62) : Error: Unable to find 'openssl\opensslv.h'
      src\SWIG\_m2crypto.i(68) : Error: Unable to find 'openssl\safestack.h'
      src\SWIG\_evp.i(12) : Error: Unable to find 'openssl\opensslconf.h'
      src\SWIG\_rc4.i(5) : Error: Unable to find 'openssl\opensslconf.h'
      src\SWIG\_ec.i(7) : Error: Unable to find 'openssl\opensslconf.h'
      error: command 'C:\\Program Files\\swigwin-4.1.1\\swig.exe' failed with exit code 1

which is possibly to do with -I/usr/include/openssl.
I tried changing to to "-Ic:\program files\openssl-win64\include" but got
c:\Program Files\Openssl-Win64\include\openssl\e_os2.h(255) : Error: Unable to find 'stdint.h'

@dbraken, you did better than me. I think this all points to a wider installation issue that will need to be sorted out by the developers.

I had another go on a Raspberry Pi 4B running Python 3.9.2 and the example worked.

I did take the precaution of loading the swig module before doing anything else. That loaded without issue. I then loaded the arduino-iot-cloud module.

To be clear I ran the following:

pip install swig
pip install arduino-iot-cloud

I tried the above on a different Raspberry Pi 4B running Python 3.8.0 and a Raspberry Pi Zero 2 W running Python 3.9.2. They both worked.

I returned to the Windows laptop with swig added to the path as suggested by @dbracken, but that still failed at the same point as before. I tried it in a Windows PowerShell and also in a virtual environment in VSCode. I beleave in both cases swig is installed and on the search paths because the full help message is returned in response to entering "swig -help" at the command lines. But in both cases the pip install arduino_iot_cloud results in an error message saying "ModuleNotFoundError: No module named 'swig'".

I have now submitted a fix for the error:

Thanks Arduino Team, that will address the typo that we are all aware of (thanks to your much earlier comment) but it does not address M2Crypto not being able to find the OpenSSL source files (which I have in C:\usr\include\openssl)

    pip install arduino-iot-cloud
     --o<-- of previous reported output

     building 'M2Crypto._m2crypto' extension
      swigging src/SWIG/_m2crypto.i to src/SWIG/_m2crypto_wrap.c
      swig.exe -python -py3 "-IC:\Program Files\Python311\include" "-IC:\Program Files\Python311\Include" -I/usr/include/openssl -includeall -modern -builtin -outdir C:\Users\Dave\AppData\Local\Temp\pip-install-dht8se_7\m2crypto_f98172a6997e46d08984e0eb31afdd01\src\M2Crypto -o src/SWIG/_m2crypto_wrap.c src/SWIG/_m2crypto.i
      Deprecated command line option: -py3. Ignored, this option is no longer supported.
      Deprecated command line option: -modern. Ignored, this option is now always on.
      src\SWIG\_m2crypto.i(62) : Error: Unable to find 'openssl\opensslv.h'
      src\SWIG\_m2crypto.i(68) : Error: Unable to find 'openssl\safestack.h'
      src\SWIG\_evp.i(12) : Error: Unable to find 'openssl\opensslconf.h'
      src\SWIG\_rc4.i(5) : Error: Unable to find 'openssl\opensslconf.h'
      src\SWIG\_ec.i(7) : Error: Unable to find 'openssl\opensslconf.h'
      error: command 'C:\\Users\\Dave\\Downloads\\swigwin-4.1.1\\swigwin-4.1.1\\swig.exe' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for M2Crypto
  Running setup.py clean for M2Crypto
Failed to build M2Crypto

After seeing your post above, I started again with a fresh installation of Python 3.11.4 on windows 10, pip install wheel, installed swig and put it in the path, downloaded OpenSSL and have it in the location above but I cannot install arduino-iot-cloud. What am I missing? If somebody has installed this on Windows 10/11, please let us know how your process differs.

I agree that this must be addressed if the tutorial is to be of any use for many of those who it is intended to serve.

Even though my level of technical expertise is significantly higher than what should be considered the prerequisite for following such a tutorial, I was unable to find any reasonable way to install all the dependencies on my Windows machine.

@dbeamonte_arduino would you mind following up on this and help the content team to make the tutorial and/or Python package into something the target user has any hope of using on Windows?

1 Like

I just tried to install swig then arduino-iot-cloud to the global installation of Python 3.11.4 (i.e. not a virtual env) on a Windows 11 laptop. I got the same net result as @dbracken.


PS C:\Users\account\Documents> pip install arduino-iot-cloud
Collecting arduino-iot-cloud
  Using cached arduino_iot_cloud-0.0.7-py3-none-any.whl (19 kB)
Collecting cbor2>=5.4.6 (from arduino-iot-cloud)
  Using cached cbor2-5.4.6-cp311-cp311-win_amd64.whl (59 kB)
Collecting M2Crypto>=0.38.0 (from arduino-iot-cloud)
  Downloading M2Crypto-0.39.0.tar.gz (1.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 5.7 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting micropython-senml>=0.1.0 (from arduino-iot-cloud)
  Using cached micropython_senml-0.1.0-py2.py3-none-any.whl (10 kB)
Building wheels for collected packages: M2Crypto
  Building wheel for M2Crypto (pyproject.toml) ... error
  error: subprocess-exited-with-error

  Γ— Building wheel for M2Crypto (pyproject.toml) did not run successfully.
  β”‚ exit code: 1
  ╰─> [60 lines of output]
      INFO:run_command:running bdist_wheel
      INFO:run_command:running build
      INFO:run_command:running build_py
      INFO:copy_file:copying src\M2Crypto\ASN1.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\AuthCookie.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\BIO.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\BN.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\callback.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\DH.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\DSA.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\EC.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\Engine.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\Err.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\EVP.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\ftpslib.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\httpslib.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\m2.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\m2crypto.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\m2urllib.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\m2urllib2.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\m2xmlrpclib.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\Rand.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\RC4.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\RSA.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\six.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\SMIME.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\threading.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\util.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\X509.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:copy_file:copying src\M2Crypto\__init__.py -> build\lib.win-amd64-cpython-311\M2Crypto
      INFO:mkpath:creating build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\cb.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\Checker.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\Cipher.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\Connection.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\Context.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\Session.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\SSLServer.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\ssl_dispatcher.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\timeout.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\TwistedProtocolWrapper.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:copy_file:copying src\M2Crypto\SSL\__init__.py -> build\lib.win-amd64-cpython-311\M2Crypto\SSL
      INFO:run_command:running egg_info
      INFO:write_pkg_info:writing src\M2Crypto.egg-info\PKG-INFO
      INFO:write_file:writing dependency_links to src\M2Crypto.egg-info\dependency_links.txt
      INFO:write_file:writing top-level names to src\M2Crypto.egg-info\top_level.txt
      INFO:read_manifest:reading manifest file 'src\M2Crypto.egg-info\SOURCES.txt'
      INFO:read_template:reading manifest template 'MANIFEST.in'
      INFO:add_license_files:adding license file 'LICENCE'
      INFO:execute:writing manifest file 'src\M2Crypto.egg-info\SOURCES.txt'
      INFO:run_command:running build_ext
      INFO:build_extension:building 'M2Crypto._m2crypto' extension
      INFO:swig_sources:swigging src/SWIG/_m2crypto.i to src/SWIG/_m2crypto_wrap.c
      INFO:spawn:swig.exe -python -py3 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Include" -I/usr/include/openssl -includeall -modern -builtin -outdir C:\Users\robsm\AppData\Local\Temp\pip-install-loq1m9s3\m2crypto_98b5650a05a54b4da82e4064f6cf74de\src\M2Crypto -o src/SWIG/_m2crypto_wrap.c src/SWIG/_m2crypto.i
      Traceback (most recent call last):
        File "<frozen runpy>", line 198, in _run_module_as_main
        File "<frozen runpy>", line 88, in _run_code
        File "C:\Users\account\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts\swig.exe\__main__.py", line 4, in <module>
      ModuleNotFoundError: No module named 'swig'
      error: command 'C:\\Users\\account\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\Scripts\\swig.exe' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for M2Crypto
Failed to build M2Crypto
ERROR: Could not build wheels for M2Crypto, which is required to install pyproject.toml-based projects
PS C:\Users\account\Documents> python --version
Python 3.11.4

Hi all! Pip needs a little help to get the dependencies installed. Here's how I got to install it on macOS:

  • pip install swig
  • brew install openssl
  • pip install --global-option=build_ext --global-option="-I/usr/local/opt/openssl/include" m2crypto
  • pip install arduino-iot-cloud

On Windows something like this should work:

  • pip install swig
  • choco install openssl
  • pip install --global-option=build_ext --global-option="-IC:\Program Files\OpenSSL-Win64\include" m2crypto
  • pip install arduino-iot-cloud

If that doesn't work, please take a look here: INSTALL.rst Β· master Β· m2crypto / m2crypto Β· GitLab

Thnx, I followed your macOS steps above and I'm also/still getting an error claiming that the swig module cannot be found. But it's there, see attached screen shot. Any suggestions?


.

Hello everyone!

The arduino-iot-cloud package has been updated recently. Previously, the M2Crypto package was needed for authentication, but you can now use basic authentication (Device ID & Secret Key that is obtained during device config).

To use it, the swig package also needs to be installed (using pip install swig). Installation of has been tested on both Mac & Windows and is now working. Hopefully this will resolve the issues that you guys are having.

I have made some small modifications to the documentation, such as adding the swig installation instructions. Also, thank you @ptillisch for updating the incorrect installation instructions.

Note: you may need to delete/uninstall the arduino-iot-cloud package and re-install it, this was the case for me.

1 Like

That's a solution for Windows 11 running Python 3.11.5 - confirmed.

Happy it worked @robertics, please feel free to share the results of your project at any time, I'd be interested to see how it worked out :slight_smile:

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.