[Solved] ImportError: No module named ‘resource’

I am using python 3.5 and I am doing Algorithms specialization courses on Coursera. Professor teaching this course posted a program which can help us to know the time and memory associated with running a program. It has import resource command at the top. I tried to run this program along with the programs I have written in python and every time I received ImportError: No module named 'resource'

I used the same code in ubuntu and have no errors at all.

I followed suggestions in stackoverflow answers and I have tried adding PYTHONPATH PYTHONHOME and edited the PATH environment variable.

I have no idea of what else I can do here.

Is there any file that I can download and install it in the Lib or site-packages folder of my python installation ?

Enquirer: Ravi M

Solution #1:

resource is a Unix specific package as seen in which is why it worked for you in Ubuntu, but raised an error when trying to use it in Windows.

Respondent: Doshmajhan
Solution #2:

I ran into similar error in window 10. Here is what solved it for me.

  1. Downgrade to the Apache Spark 2

    3.2 prebuild version

  2. Install (or downgrade) jdk to version 1.8.0
    • My installed jdk was 1.9.0, which doesn’t seem to be compatiable with spark 2.3.2 or 2.4.0
  3. make sure that when you run java -version in cmd (command prompt), it show java version 8. If you are seeing version 9, you will need to change your system ENV PATH to ensure it points to java version 8.
  4. Check this link to get help on changing the PATH if you have multiple java version installed.

Hope this helps someone, I was stuck on this issue for almost a week before finally finding a solution.

Respondent: gordon1hd1
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy