Problems getting SDK running on Python - SOLVED!

Post general discussions on using our drivers to write your own software here
Post Reply
strangequark
User
User
Posts: 2
Joined: Tue Mar 05, 2019 2:48 pm

Problems getting SDK running on Python - SOLVED!

Post by strangequark »

I am running windows 64 bit with python 64 bit and am not able to import the SDK library into python and it's probably because the command line keeps throwing me an error that I have to install SDK even though I did several times. What is going on here? See screen cap when I try to install the setup. When I type "python install setup.py" like in the install instructions, it throws an error that the file cannot be found. Can we please have more detailed instructions as to how to get this working? Thanks
Attachments
screencaperror.png

tsassonx
Newbie
Posts: 0
Joined: Mon Aug 12, 2019 11:33 am

Re: Problems getting SDK running on Python - SOLVED!

Post by tsassonx »

Hi,
I have the same issue, I installed the SDK but setup.py replies:

Code: Select all

Please install the PicoSDK in order to use this wrapper.Visit https://www.picotech.com/downloads
How is the problem solved and what am I supposed to do?

tsassonx
Newbie
Posts: 0
Joined: Mon Aug 12, 2019 11:33 am

Re: Problems getting SDK running on Python - SOLVED!

Post by tsassonx »

Update:
I removed the try...except section in setup.py, then ran again

Code: Select all

python setup.py install
And the package was installed.

To investigate the phenomenon, I ran setup.py in debug mode, tracked the find_library method and in debug mode it works, it finds ps2000.dll in its lib folder.
However, when I run it regularly as stated above, I receive the above error.

cjkraz
Newbie
Posts: 0
Joined: Mon Oct 29, 2018 2:55 pm

Re: Problems getting SDK running on Python - SOLVED!

Post by cjkraz »

Hi,

I second this, we need better documentation on install for windows.

I followed the instruction for the install of the picoSDK and downloaded the python binding library for my 64 bit windows system.

Even after installing and re-installing the picoSDK multiple times I still get the following error when running >python setup.py install.
Please install the PicoSDK in order to use this wrapper.Visit https://www.picotech.com/downloads.

Can you give more info about exactly which try...except section you uncommented to get it to run? threes quite a few in the file.

Greatly appreciated!
Thanks

tsassonx
Newbie
Posts: 0
Joined: Mon Aug 12, 2019 11:33 am

Re: Problems getting SDK running on Python - SOLVED!

Post by tsassonx »

Are you sure you saw quite a few? Perhaps we're looking at different versions, but this is the newest version of setup.py file, use this one (with commented part as my edit):

Code: Select all

#
# Copyright (C) 2017-2018 Pico Technology Ltd.
#
from __future__ import print_function
from distutils.core import setup

import ctypes
from ctypes import *
from ctypes.util import find_library
import sys
import os.path


# signalfile = ".sdkwarning"
# if not os.path.exists(signalfile):
#     name = 'ps2000'
#     try:
#         if sys.platform == 'win32':
#             result = ctypes.WinDLL(find_library(name))
#         else:
#             result = cdll.LoadLibrary(find_library(name))
#     except OSError:
#         print("Please install the PicoSDK in order to use this wrapper."
#               "Visit https://www.picotech.com/downloads")
#         exit(1)
#     open(signalfile, 'a').close()


setup(name='PicoSDK',
      version='1.0',
      description='PicoSDK Python wrapper',
      author='Pico Technology Ltd',
      author_email='support@picotech.com',
      url='https://www.picotech.com',
      packages=['picosdk'])


Christin
Newbie
Posts: 0
Joined: Sun Apr 19, 2020 11:01 am

Re: Problems getting SDK running on Python - SOLVED!

Post by Christin »

emmm,it's amazing,I have tried so many different methods,but all didn't work until I restart my computer.....So may be you can try.

Best wishes

sir_oslay
Newbie
Posts: 0
Joined: Mon Sep 07, 2020 2:47 pm

Re: Problems getting SDK running on Python - SOLVED!

Post by sir_oslay »

I had the same issue installing the python wrappers. Turns out it was as simple as changing the line

Code: Select all

name = 'ps2000'
in setup.py to

Code: Select all

name = 'ps5000'
. I had only installed the SDK for the 5000 series because that's the only one I need and so the 2000 series libraries didn't exist, which is why the setup kept saying I needed to install the SDK.

And restarting your computer may be required for Windows if the SDK lib directory was added to the system PATH variable when the SDK was installed.

dif
Newbie
Posts: 0
Joined: Wed Jun 09, 2021 11:41 am

Re: Problems getting SDK running on Python - SOLVED!

Post by dif »

I got the same problem when I was trying to install the python wrapper.
I found out that it was related to the fact that I have the PicoSDK and the PicoScope 6 application installed.

I made the setup.py print out the exception that was thrown:

Code: Select all

[WinError 193] %1 is not a valid Win32 application
Thus, I thought it had something to do with the common 64 vs 32 bit problem. However after ensuring that everything I've installed was 64-bit I started to look for other alternatives.
In the end I figured that I might as well print the found library

Code: Select all

print(f'Library: {find_library(name)}')
Library: C:\Program Files (x86)\Pico Technology\PicoScope6\ps2000.dll
That's when I realised that the found .dll was not the one located within the SDK, but the one inside the Picoscope application. So I manullay set the library,

Code: Select all

lib = r'C:\Program Files\Pico Technology\SDK\lib\ps2000.dll'
result = ctypes.WinDLL(lib)
And then I could finally install the wrapper with the setup.py script.

My next problem is that the Library class in the wrapper uses the ctypes.util.find_library( ) to identify the .dlls. So even though I could install it, I can still not use it without making changes to the wrapper code itself. Does anyone know how to circumvent this problem?

tsassonx
Newbie
Posts: 0
Joined: Mon Aug 12, 2019 11:33 am

Re: Problems getting SDK running on Python - SOLVED!

Post by tsassonx »

Are you saying the 'ps2000.dll' is not the same version, or not the same one?
Perhaps you can look in the Path environment variable and change the order of the paths looked at, so the SDK will get a priority over the Picoscope directory.

Post Reply