3 Replies - 647 Views - Last Post: 10 October 2018 - 11:50 AM Rate Topic: -----

#1 esadri21   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 80
  • Joined: 09-November 17

ImportError: cannot import name plots. In UBUNTU and WINDOWS

Posted 09 October 2018 - 02:40 PM

I am working on this tutorial.

it has one line as the following:

from getdist import plots, MCSamples

but python send error which:

ImportError: cannot import name plots 

what should I do? I need it, but it sends this error.

I am using python 2.7

Thank you.

Is This A Good Question/Topic? 0
  • +

Replies To: ImportError: cannot import name plots. In UBUNTU and WINDOWS

#2 bobsmith76   User is offline

  • D.I.C Regular

Reputation: 11
  • View blog
  • Posts: 332
  • Joined: 14-February 17

Re: ImportError: cannot import name plots. In UBUNTU and WINDOWS

Posted 10 October 2018 - 10:28 AM

What directory are you in when you call the function or module? I've had this problem a lot. Can you try to find out where the getdist file is located then tell us the heirarchy of your directories plus what directory you are currently in when you call the module? Can you also post the whole code that you are using?

Also, at the risk of beating a dead horse can you upgrade to python 3.7? I realize it's hard for a beginner but if you're going to be serious about python, you've got to keep up with the times.

Also, I forgot that the easiest fix is to just write


pip install getdisk


in Ubuntu or whatever command line prompt you're using. Try that first and if that doesn't work call us.

This post has been edited by bobsmith76: 10 October 2018 - 10:31 AM

Was This Post Helpful? 1
  • +
  • -

#3 esadri21   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 80
  • Joined: 09-November 17

Re: ImportError: cannot import name plots. In UBUNTU and WINDOWS

Posted 10 October 2018 - 11:24 AM

Python has many weaknesses in its kinds of errors and warnings.

The name of python file was as the same as the mudule. After two days I changed it and it woirked. There are too many stupid guidance in python which should be improved.
Was This Post Helpful? 0
  • +
  • -

#4 bobsmith76   User is offline

  • D.I.C Regular

Reputation: 11
  • View blog
  • Posts: 332
  • Joined: 14-February 17

Re: ImportError: cannot import name plots. In UBUNTU and WINDOWS

Posted 10 October 2018 - 11:50 AM

So is the problem solved? If not did you try pip install?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1