ImportError: no module named 'resource'

I am using python 3.5 and I am taking Algorithm specialization courses on Coursera. A professor teaching this course has published a program that will help us find out the time and memory associated with running the program. It has an import resource command at the top. I tried to run this program along with programs written in python, and every time I got ImportError: No module named 'resource'

I used the same code in ubuntu and had no errors.

I followed the suggestions in stackoverflow answers and I tried to add PYTHONPATH PYTHONHOME and edit the PATH environment variable.

I do not know what else I can do here.

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

+7
source share
2 answers

resource is a special Unix package, as shown in https://docs.python.org/2/library/resource.html , so it worked for you on Ubuntu, but raised an error when trying to use it on Windows.

+8
source

I ran into a similar error in window 10. That's what solved this for me.

  1. Upgrading to the pre-built version of Apache Spark 2.3.2
  2. Install (or upgrade) jdk to version 1.8.0
    • My installed jdk was 1.9.0, which doesn't seem to be compatible with spark 2.3.2 or 2.4.0
  3. make sure that when running java -version in cmd (command line) version of java 8 is displayed. If you see version 9, you will need to change the system ENV PATH to point to version 8 of Java.
  4. Check this link for help changing PATH if you have multiple versions of Java installed.

I hope this helps someone, I got stuck in this problem for almost a week before I finally found a solution.

0
source

All Articles