Need help: "module 'matplotlib.cm' has no attribute 'get_cmap'" Error & different configparser error #36
-
Hello, this project looks amazing, and I was thrilled to test it, but I'm not able to get the Thermalcam working. I tried it on a Raspberry Pi 3b*+ with multiple OS versions, with and without
Thanks in Advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Not a lot of time now but these sound like installation issues. Maybe verify that you've followed the setup/install instructions at https://tomshaffner.github.io/PiThermalCam/ and see if that fixes?
Am Mo., Mai 20, 2024 at 15:51 schrieb ***@***.***>:
Hello, this project looks amazing, and I was thrilled to test it, but I'm not able to get the Thermalcam working. I tried it on a Raspberry Pi 3b*+ with multiple OS versions, with and without venv but at last I got 2 different errors I couldn't solve. (sorry for the bad markdown; this is my first time posting)
I dug in the files and the code a bit, but I didn't change something because I think everyone's better than me as a maybe, mediocre Python beginner, so I hope someone can help get it working. The installation routine pip3 install pithermalcam finished without errors (I tried the manual setup either).
Pi3B, fresh Rasbian Bookworm 64bit, Thermalcam has the right i2c address
- Normal installation without customized opencv raises "module matplotlib.cm' has no attribute 'get_cmap' error. With an IDE and in the API I can't find the get_cmap attribute with matplotlib.cm so I don't know what to do with the cmapy.py or am I looking at the false place?
import pithermalcam as ptc
ptc.stream_camera_online()
/home/pi/proj-thermalcam2/lib/python3.11/site-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py:30: RuntimeWarning: I2C frequency is not settable in python, ignoring!
warnings.warn(
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/proj-thermalcam2/lib/python3.11/site-packages/pithermalcam/__init__.py", line 38, in stream_camera_online
web_server.start_server(output_folder=output_folder)
File "/home/pi/proj-thermalcam2/lib/python3.11/site-packages/pithermalcam/web_server.py", line 134, in start_server
thermcam = pithermalcam(output_folder=output_folder)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/proj-thermalcam2/lib/python3.11/site-packages/pithermalcam/pi_therm_cam.py", line 50, in __init__
self.update_image_frame()
File "/home/pi/proj-thermalcam2/lib/python3.11/site-packages/pithermalcam/pi_therm_cam.py", line 228, in update_image_frame
self._process_raw_image()
File "/home/pi/proj-thermalcam2/lib/python3.11/site-packages/pithermalcam/pi_therm_cam.py", line 114, in _process_raw_image
self._image = cv2.applyColorMap(self._raw_image, cmapy.cmap(self._colormap_list[self._colormap_index]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/proj-thermalcam2/lib/python3.11/site-packages/cmapy.py", line 148, in cmap
c_map = matplotlib.cm.get_cmap(cmap_name, 256)
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'
- I want to try the opencv version (I thought, because of the matplot error, the standard scripts use this version), so after cloning the git and starting the file I get a configparser error. Looks like it can't read the file and section FILEPATHS. Fiddling with some file read/write permissions and some other stuff, I can't solve this error either. The config file and everything else are in the place where it have been installed.
python3 /home/pi/PiThermalCam/sequential_versions/opencv_therm_cam.py
2024-05-20 21:00:41,916 DEBUG [opencv_therm_cam.py:__main__:32] Config file sections found: []
2024-05-20 21:00:41,917 DEBUG [opencv_therm_cam.py:__main__:36] Reading config file and initializing variables...
Traceback (most recent call last):
File "/home/pi/PiThermalCam/sequential_versions/opencv_therm_cam.py", line 37, in <module>
output_folder = config.get(section='FILEPATHS',option='output_folder',raw=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/configparser.py", line 797, in get
d = self._unify_values(section, vars)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/configparser.py", line 1168, in _unify_values
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'FILEPATHS'
Thanks in Advance
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Got it solved. Kind of. I did not know if I should edit the source comment, so I write it as an answer. The Matplotlib error hints at it. It seems they changed a thing or two in the matplotlib API with v3.7 and cmapy isn't working as it should be. So you can uninstall the latest matplotlib version, and I got it working with v3.6.3. cmapy is not updated since 2020. But maybe you can easily change some code in cmapy to get it working with the newest versions of all packages. Time to check some temperatures :) |
Beta Was this translation helpful? Give feedback.
Got it solved. Kind of. I did not know if I should edit the source comment, so I write it as an answer. The Matplotlib error hints at it. It seems they changed a thing or two in the matplotlib API with v3.7 and cmapy isn't working as it should be. So you can uninstall the latest matplotlib version, and I got it working with v3.6.3. cmapy is not updated since 2020. But maybe you can easily change some code in cmapy to get it working with the newest versions of all packages. Time to check some temperatures :)