Can't import CoolProp in Raspberry pi 4 Python 3.7.6

245 views
Skip to first unread message

LasseLRP

unread,
Feb 19, 2020, 7:15:58 PM2/19/20
to coolprop-users
Hello,
This is what I get:

Python 3.7.6 (default, Feb 19 2020, 16:18:37)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> import CoolProp as CP
Traceback (most recent call last):
 
File "<stdin>", line 1, in <module>
 
File "/home/pi/python-source/Python-3.7.6/udemy/lib/python3.7/site-packages/CoolProp/__init__.py", line 22, in <module>
    __fluids__
= CoolProp.get_global_param_string('fluids_list').split(',')
 
File "CoolProp.pyx", line 277, in CoolProp.CoolProp.get_global_param_string
 
File "stringsource", line 15, in string.from_py.__pyx_convert_string_from_py_std__in_string
TypeError: expected bytes, str found
>>>

Help appreciated.

Ian Bell

unread,
Feb 19, 2020, 8:21:30 PM2/19/20
to coolpro...@googlegroups.com
Please use the development version, this bug is fixed.

--
You received this message because you are subscribed to the Google Groups "coolprop-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coolprop-users/362c524b-1e3a-4ab5-9b74-7a307b523b96%40googlegroups.com.

LasseLRP

unread,
Feb 20, 2020, 5:24:40 PM2/20/20
to coolprop-users
I ran this:
pip install -vvv --pre --trusted-host www.coolprop.dreamhosters.com --find-links http://www.coolprop.dreamhosters.com/binaries/Python/ -U --force-reinstall CoolProp

I have cmake and 7-zip.

Got a bit different error:

Python 3.7.6 (default, Feb 19 2020, 16:18:37)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import CoolProp

Traceback (most recent call last):
 
File "<stdin>", line 1, in <module>

 
File "/usr/local/opt/python-3.7.6/lib/python3.7/site-packages/CoolProp/__init__.py", line 22, in <module>
    __fluids__
= CoolProp.get_global_param_string(b'fluids_list').split(',')
TypeError: a bytes-like object is required, not 'str'




On Thursday, February 20, 2020 at 3:21:30 AM UTC+2, Ian Bell wrote:
Please use the development version, this bug is fixed.

On Wed, Feb 19, 2020, 6:16 PM LasseLRP <lass...@gmail.com> wrote:
Hello,
This is what I get:

Python 3.7.6 (default, Feb 19 2020, 16:18:37)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> import CoolProp as CP
Traceback (most recent call last):
 
File "<stdin>", line 1, in <module>
 
File "/home/pi/python-source/Python-3.7.6/udemy/lib/python3.7/site-packages/CoolProp/__init__.py", line 22, in <module>
    __fluids__
= CoolProp.get_global_param_string('fluids_list').split(',')
 
File "CoolProp.pyx", line 277, in CoolProp.CoolProp.get_global_param_string
 
File "stringsource", line 15, in string.from_py.__pyx_convert_string_from_py_std__in_string
TypeError: expected bytes, str found
>>>

Help appreciated.

--
You received this message because you are subscribed to the Google Groups "coolprop-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coolpro...@googlegroups.com.

Ian Bell

unread,
Feb 20, 2020, 7:04:57 PM2/20/20
to coolpro...@googlegroups.com
Well, the bug is fixed I believe, but we have the problem that our build system is partially broken right now, so your best bet is to build it yourself.  Also, on the Raspberry Pi, you don't have a choice, because binaries compiled for x86_64 will not work on an ARM architecture, which is what I believe you have on the Raspberry PI, or was last I checked.

To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coolprop-users/feea097c-8dbd-4d69-b890-6c5056c0ded4%40googlegroups.com.

LasseLRP

unread,
Feb 20, 2020, 7:22:47 PM2/20/20
to coolprop-users
I get alot of these:
 /usr/include/c++/8/bits/stl_vector.h:1549:4: note: parameter passing for argument of type __gnu_cxx::__normal_iterator<const double*, std::vector<double> >’ changed in GCC 7.1
 
/usr/include/c++/8/bits/stl_vector.h:1549:4: note: parameter passing for argument of type std::vector<double>::iterator {aka __gnu_cxx::__normal_iterator<double*, std::vector<double> >’} changed in GCC 7.1
      _M_range_insert
(__pos, __first, __last,
     
^~~~~~~~~~~~~~~
 
/usr/include/c++/8/bits/stl_vector.h:1549:4: note: parameter passing for argument of type __gnu_cxx::__normal_iterator<const double*, std::vector<double> >’ changed in GCC 7.1
 
/usr/include/c++/8/bits/stl_vector.h: In member function void CoolProp::JSONFluidLibrary::parse_EOS(rapidjson::Value&, CoolProp::CoolPropFluid&)’:
 
/usr/include/c++/8/bits/stl_vector.h:1085:4: note: parameter passing for argument of type __gnu_cxx::__normal_iterator<CoolProp::EquationOfState*, std::vector<CoolProp::EquationOfState> >’ changed in GCC 7.1
      _M_realloc_insert
(end(), __x);
Those changed in GCC 7.1-things...
I have gcc version 8.3.0

Ian Bell

unread,
Feb 20, 2020, 7:28:37 PM2/20/20
to coolpro...@googlegroups.com
Those seem to be warnings, not errors?  I don't get that kind of output when I compile on linux with gcc 7.4.x for what its worth.

To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coolprop-users/f6c66522-d091-4ab1-b550-c2707f0df2b4%40googlegroups.com.

LasseLRP

unread,
Feb 22, 2020, 12:12:16 PM2/22/20
to coolprop-users
Tried this:
sudo python3 setup.py install 

got this:
Python 3.6.9 (default, Nov  7 2019, 10:44:02)

[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import CoolProp
Traceback (most recent call last):
 
File "<stdin>", line 1, in <module>

 
File "/home/ubuntu/CoolProp/wrappers/Python/CoolProp/__init__.py", line 5, in <module>
   
from . import constants
 
File "/home/ubuntu/CoolProp/wrappers/Python/CoolProp/constants.py", line 5, in <module>
   
from . import _constants
ImportError: cannot import name '_constants'


Now running Ubuntu on Raspberry Pi 4

Ian Bell

unread,
Feb 22, 2020, 12:14:47 PM2/22/20
to coolpro...@googlegroups.com
Move out of that directory before you try the python import.  I get tripped up by this all the time - it was trying to import from the build folder, and that doesn't work. I tried to find a nice way to warn about this, but never found an adequate solution.

To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coolprop-users/28505a99-d04f-4140-89a9-1c6a4560d3ed%40googlegroups.com.

LasseLRP

unread,
Feb 22, 2020, 1:10:16 PM2/22/20
to coolprop-users
From home directory, different error:
ubuntu@ubuntu:~$ python3
Python 3.6.9 (default, Nov  7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import CoolProp
Traceback (most recent call last):
 
File "<stdin>", line 1, in <module>

 
File "/usr/local/lib/python3.6/dist-packages/CoolProp-6.3.1.dev0-py3.6-linux-aarch64.egg/CoolProp/__init__.py", line 22, in <module>
    __fluids__
= CoolProp.get_global_param_string(b'fluids_list').split(b',')
TypeError: must be str or None, not bytes

Ian Bell

unread,
Feb 22, 2020, 1:55:18 PM2/22/20
to coolpro...@googlegroups.com
Ugh... strings are a real headache when you have python 2, python 3, and cython in the mix. I was able to confirm this bug in both python 3.6 and 3.8 when building from source.

To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coolprop-users/fa4f360e-9bb4-471f-b53e-5b0e70605692%40googlegroups.com.

Ian Bell

unread,
Feb 22, 2020, 2:30:57 PM2/22/20
to coolpro...@googlegroups.com
Try again now with updated cython. I think it should work...  But maybe I just broke python 2.7 ?

LasseLRP

unread,
Feb 22, 2020, 2:39:45 PM2/22/20
to coolprop-users
Do mean 
sudo pip install --update Cython:
cd CoolProp/wrappers/Python
sudo python setup.py install

On Saturday, February 22, 2020 at 9:30:57 PM UTC+2, Ian Bell wrote:
Try again now with updated cython. I think it should work...  But maybe I just broke python 2.7 ?

Ian Bell

unread,
Feb 22, 2020, 2:42:18 PM2/22/20
to coolpro...@googlegroups.com
This should be enough:

cd CoolProp/wrappers/Python
git pull
sudo python setup.py install

To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coolprop-users/6d5fa8d4-e387-4cfd-a06b-bbf82b5f84ae%40googlegroups.com.

LasseLRP

unread,
Feb 22, 2020, 3:46:27 PM2/22/20
to coolprop-users
!!!!! TaDaaa !!!!

ubuntu@ubuntu:~$ python3.8
Python 3.8.0 (default, Feb 22 2020, 19:21:55)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import CoolProp
>>>


It worked. Thanks a lot!

Vikram Govindarajan

unread,
Jun 17, 2022, 4:52:29 AM6/17/22
to coolprop-users
I am facing the same issue in python3.8 in WSL ubuntu 2004. I installed CoolProp 6.4.1 with the source downloaded from pypi. Can you please tell me what I should be doing in summary? 

File "stringsource", line 15, in string.from_py.__pyx_convert_string_from_py_std__in_string
TypeError: expected bytes, str found


Ian Bell

unread,
Jun 17, 2022, 4:39:41 PM6/17/22
to coolpro...@googlegroups.com
Please try the new binary wheels: https://github.com/CoolProp/CoolProp/issues/2119

To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coolprop-users/48fd7601-285e-4ddf-a94e-9bea424f1207n%40googlegroups.com.

Vikram Govindarajan

unread,
Jun 20, 2022, 9:24:50 AM6/20/22
to coolprop-users
The latest wheels in pypi are not available on my platform (WSL Ubuntu 2004 on Windows 10). Whether the latest source available? Also, how to install CoolProp from source?

Help appreciated.

Ian Bell

unread,
Jun 20, 2022, 9:33:26 AM6/20/22
to coolpro...@googlegroups.com
Right,  you need to use the development wheels indicated in the issue I linked. Also,  I backported binary wheels for all platforms for 6.4.1 two days ago,  so try it again

Reply all
Reply to author
Forward
0 new messages