Importing diffractio on Google Colab

Issue #11 resolved
Can Polat created an issue

Hi,

Whenever you "! pip install diffractio" and then try to import it with "import diffractio" you get an error as below:


TypeError Traceback (most recent call last)
<ipython-input-2-cea5d3fb97cf> in <module>()
----> 1 import diffractio

/usr/local/lib/python3.7/dist-packages/diffractio/init.py in <module>()
42 num_max_processors = multiprocessing.cpu_count()
43
---> 44 freq_max = psutil.cpu_freq()[2]
45 info_memory = psutil.virtual_memory()[0] / 1024**3
46 memory_available = psutil.virtual_memory(

TypeError: 'NoneType' object is not subscriptable


I have found the solution by changing line 44 into "freq_max = psutil.cpu_freq()" and closing the
line 54 print("max frequency : {:1.0f} GHz".format(freq_max)) with "#".

Sincerely,
Can Polat

Comments (3)

  1. LUIS MIGUEL SANCHEZ BREA repo owner

    Dear Can Polat.

    Thank you very much for your feedback.

    Please, check if: print("max frequency : {:1.0f} GHz".format(freq_max[2])) works.

    I do not understand: line 54 print("max frequency : {:1.0f} GHz".format(freq_max)) with "#". At the end of the line "#" does nothing.

    regards.

  2. Can Polat reporter

    Dear Luis Miguel Sanchez Brea,

    It is not working when I change it.

    However, what I meant was if you change line 44 to freq_max = psutil.cpu_freq() and close the line 54 as #print("max frequency : {:1.0f} GHz".format(freq_max)) it works. Cannot see the CPU freq but not really necessary for this anyway.

    Sincerely,

    Can Polat

  3. LUIS MIGUEL SANCHEZ BREA repo owner

    Thank you for the suggestion.

    I think you are right. I have removed the computer information at init and changed to a function, computer_parameters, at utils_common module.

    I hope this way, you do not have a an error.

  4. Log in to comment