Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing max31855 in python 3 #10

Open
Yobeco opened this issue Aug 15, 2019 · 2 comments
Open

Installing max31855 in python 3 #10

Yobeco opened this issue Aug 15, 2019 · 2 comments

Comments

@Yobeco
Copy link

Yobeco commented Aug 15, 2019

Hi

I'm trying to install your max31855's module to use two "k thermocouples" on a Raspberry pi 3 under Raspbian 10.0.
The installation seems to be ok...
When I call it in Python 3 :

>>> import max31855
>>>

I don't have any error message.

Here is the python script that I use to check the sensor :

   # from max31855 import MAX31855, MAX31855Error
    import max31855

    cs_pin=24
    clock_pin=23
    data_pin=22
    unit="f"
    thermocouple1=MAX31855(cs_pin, clock_pin, data_pin, units)
    print(thermocouple.get())
    thermocouple.cleanup()

Any time, I have the same message error :

Traceback (most recent call last):
  File "Essai_MAX31855_V1.py", line 8, in <module>
    thermocouple1=MAX31855(cs_pin, clock_pin, data_pin, units)
NameError: name 'MAX31855' is not defined

Do you have any idea ?

Thank you :-)

@Tuckie
Copy link
Owner

Tuckie commented Aug 15, 2019

Could you try uncommenting the first line?

from:

# from max31855 import MAX31855, MAX31855Error

to this:

from max31855 import MAX31855, MAX31855Error

@Yobeco
Copy link
Author

Yobeco commented Aug 17, 2019

Ok
I did it.
But I did it on a new installation of Raspbian on my Raspberry Pi 3.
First, I activate "SSH", "VNC", "SPI" and "Remote GPIO".

Here is alI I did on my full clear new installation of Raspbian:

1- New installation of Raspbian on a Rpi3

pi@raspberrypi:~/Python/Essais_MAX31855 $ uname -a
Linux raspberrypi 4.19.58-v7+ #1245 SMP Fri Jul 12 17:25:51 BST 2019 armv7l GNU/Linux
pi@raspberrypi:~ $ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 10 (buster)
Release:	10
Codename:	buster
pi@raspberrypi:~ $ 

2- Installation of the module

pi@raspberrypi:~ $ git clone https://github.com/Tuckie/max31855

Clonage dans 'max31855'...
remote: Enumerating objects: 33, done.
remote: Total 33 (delta 0), reused 0 (delta 0), pack-reused 33
Dépaquetage des objets: 100% (33/33), fait.


pi@raspberrypi:~ $ cd max31855/
pi@raspberrypi:~/max31855 $ sudo python3 setup.py install
running install
running bdist_egg
running egg_info
creating max31855.egg-info
writing max31855.egg-info/PKG-INFO
writing dependency_links to max31855.egg-info/dependency_links.txt
writing top-level names to max31855.egg-info/top_level.txt
writing manifest file 'max31855.egg-info/SOURCES.txt'
reading manifest file 'max31855.egg-info/SOURCES.txt'
writing manifest file 'max31855.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
warning: install_lib: 'build/lib' does not exist -- no Python modules to install

creating build
creating build/bdist.linux-armv7l
creating build/bdist.linux-armv7l/egg
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying max31855.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying max31855.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying max31855.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying max31855.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/max31855-2.0-py3.7.egg' and adding 'build/bdist.linux-armv7l/egg' to it
removing 'build/bdist.linux-armv7l/egg' (and everything under it)
Processing max31855-2.0-py3.7.egg
Copying max31855-2.0-py3.7.egg to /usr/local/lib/python3.7/dist-packages
Adding max31855 2.0 to easy-install.pth file

Installed /usr/local/lib/python3.7/dist-packages/max31855-2.0-py3.7.egg
Processing dependencies for max31855==2.0
Finished processing dependencies for max31855==2.0

3- Checking of the module

pi@raspberrypi:~/max31855 $ python3
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import max31855
>>>
>>> exit()

4- Running the test script

pi@raspberrypi:~/max31855 $ cd /home/pi/Python/Essais_MAX31855/
pi@raspberrypi:~/Python/Essais_MAX31855 $ python3 Essai_MAX31855_V1.py 
Traceback (most recent call last):
  File "Essai_MAX31855_V1.py", line 1, in <module>
    from max31855 import MAX31855, MAX31855Error

The code of "Essai_MAX31855_V1.py":

from max31855 import MAX31855, MAX31855Error

cs_pin=24
clock_pin=23
data_pin=22
unit="f"
thermocouple1=MAX31855(cs_pin, clock_pin, data_pin, units)
print(thermocouple.get())
thermocouple.cleanup()

5- New installation of the module in the folder of the test script

pi@raspberrypi:~/max31855 $ cd /home/pi/Python/Essais_MAX31855/
pi@raspberrypi:~/Python/Essais_MAX31855 $ git clone https://github.com/Tuckie/max31855
Clonage dans 'max31855'...

remote: Enumerating objects: 33, done.
remote: Total 33 (delta 0), reused 0 (delta 0), pack-reused 33
Dépaquetage des objets: 100% (33/33), fait.
pi@raspberrypi:~/Python/Essais_MAX31855 $ 


pi@raspberrypi:~/Python/Essais_MAX31855 $ cd max31855/
pi@raspberrypi:~/Python/Essais_MAX31855/max31855 $ sudo python3 setup.py install
running install
running bdist_egg
running egg_info
creating max31855.egg-info
writing max31855.egg-info/PKG-INFO
writing dependency_links to max31855.egg-info/dependency_links.txt
writing top-level names to max31855.egg-info/top_level.txt
writing manifest file 'max31855.egg-info/SOURCES.txt'
reading manifest file 'max31855.egg-info/SOURCES.txt'
writing manifest file 'max31855.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
warning: install_lib: 'build/lib' does not exist -- no Python modules to install

creating build
creating build/bdist.linux-armv7l
creating build/bdist.linux-armv7l/egg
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying max31855.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying max31855.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying max31855.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying max31855.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/max31855-2.0-py3.7.egg' and adding 'build/bdist.linux-armv7l/egg' to it
removing 'build/bdist.linux-armv7l/egg' (and everything under it)
Processing max31855-2.0-py3.7.egg
Removing /usr/local/lib/python3.7/dist-packages/max31855-2.0-py3.7.egg
Copying max31855-2.0-py3.7.egg to /usr/local/lib/python3.7/dist-packages
max31855 2.0 is already the active version in easy-install.pth

Installed /usr/local/lib/python3.7/dist-packages/max31855-2.0-py3.7.egg
Processing dependencies for max31855==2.0
Finished processing dependencies for max31855==2.0

6- Trying the test script again

pi@raspberrypi:~/Python/Essais_MAX31855/max31855 $ cd ..
pi@raspberrypi:~/Python/Essais_MAX31855 $ ls
Essai_MAX31855_V1.py  max31855
pi@raspberrypi:~/Python/Essais_MAX31855 $ python3 Essai_MAX31855_V1.py 
Traceback (most recent call last):
  File "Essai_MAX31855_V1.py", line 1, in <module>
    from max31855 import MAX31855, MAX31855Error
ImportError: cannot import name 'MAX31855' from 'max31855' (/home/pi/Python/Essais_MAX31855/max31855/__init__.py)
pi@raspberrypi:~/Python/Essais_MAX31855 $ 

I didn't do anything more on the OS...

Do you see any anomaly?

Thank You :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants