Python error import requests ImportError No module named requests

0 votes

I am trying to run the following code:

import sys
import time

dirPath = './copyleaks'
if dirPath not in sys.path:
    sys.path.insert(0, dirPath)

from copyleakscloud import CopyleaksCloud
from processoptions import ProcessOptions
from product import Product

An example of using the Copyleaks Python SDK and checking for status and reciving the results.

if __name__ == '__main__':
    Change to your account credentials.
    If you don't have an account yet visit
    Your API-KEY is available at your dashboard on of the product that you would like to use.
    Currently available products: Businesses, Education and Websites.
    cloud = CopyleaksCloud(Product.Businesses, '', '***************')

    print("You've got %s Copyleaks %s API credits" % (cloud.getCredits(), cloud.getProduct())) #get credit balance

    options = ProcessOptions()
    Add this process option to your process to use sandbox mode.
    The process will not consume any credits and will return dummy results.
    For more info about optional headers visit
    # Available process options
#     options.setHttpCallback("")
#     options.setHttpInProgressResultsCallback("")
#     options.setEmailCallback("")
#     options.setCustomFields({'Custom': 'field'})
#     options.setAllowPartialScan(True)
#     options.setCompareDocumentsForSimilarity(True)  # Available only on compareByFiles
#     options.setImportToDatabaseOnly(True)  # Available only on Education API

    print("Submitting a scan request...")
    Create a scan process using one of the following methods.
    Available methods:
    createByUrl, createByOcr, createByFile, createByText and createByFiles.
    For more information visit
    process = cloud.createByUrl('', options)
    # process = cloud.createByOcr('ocr-example.jpg', eOcrLanguage.English, options)
    # process = cloud.createByFile('test.txt', options)
    # process = cloud.createByText("Lorem ipsum torquent placerat quisque rutrum tempor lacinia aliquam habitant ligula arcu faucibus gravida, aenean orci lacinia mattis purus consectetur conubia mauris amet nibh consequat turpis dictumst hac ut nullam sodales nunc aenean pharetra, aenean ut sagittis leo massa nisi duis nullam iaculis, nulla ultrices consectetur facilisis curabitur scelerisque quisque primis elit sagittis dictum felis ornare class porta rhoncus lobortis donec praesent curabitur cubilia nec eleifend fringilla fusce vivamus elementum semper nisi conubia dolor, eros habitant nisl suspendisse venenatis interdum nulla interdum, libero urna maecenas potenti nam habitant aliquam donec class sem hendrerit tempus.")
    # processes, errors = cloud.createByFiles(['path/to/file1', 'path/to/file2'], options)

    print ("Submitted. In progress...")
    iscompleted = False
    while not iscompleted:
        # Get process status
        [iscompleted, percents] = process.isCompleted()
        print ('%s%s%s%%' % ('#' * int(percents / 2), "-" * (50 - int(percents / 2)), percents))
        if not iscompleted:

    print ("Process Finished!")

    # Get the scan results
    results = process.getResults()
    print ('\nFound %s results...' % (len(results)))
    for result in results:

        # Optional: Download result full text. Uncomment to activate
        #print ("Result full-text:")

        # Optional: Download comparison report. Uncomment to activate
        #print ("Comparison report:")
        #print (process.getResultComparison(result))

    # Optional: Download source full text. Uncomment to activate.
    #print ("Source full-text:")

And I end up with the following error:

import requests ImportError: No module named requests
Aug 5, 2019 in Python by Vashi

2 answers to this question.

0 votes

Hi @Vasgi, for the code you're trying to run, you'll need to install the following python modules: requests, python-dateutil, enum34. Use the following commands:

pip3 install requests
pip3 install python-dateutil
pip3 install enum34
answered Aug 5, 2019 by Layla
i installed then also its showing

Hello @miihir.

Depends on which os you are using or the version of python you are using. The above solution of @ Layla works on window with python3 installed.

For OSX/Linux

Use $ sudo pip install requests (or pip3 install requests for python3) if you have pip installed. If pip is installed but not in your path you can use python -m pip install requests (or python3 -m pip install requests for python3)

Alternatively you can also use sudo easy_install -U requests if you have easy_install installed.

For centos: yum install python-requests For Ubuntu: apt-get install python-requests


Use pip install requests (or pip3 install requests for python3) if you have pip installed and Pip.exe added to the Path Environment Variable. If pip is installed but not in your path you can use python -m pip install requests (or python3 -m pip install requests for python3)

Alternatively from a cmd prompt, use > Path\easy_install.exe requests, where Path is your Python*\Scripts folder, if it was installed. (For example: C:\Python32\Scripts)

Hope it helps!!

Hi, @Mihir,

I know there are many posts on this, and I've tried using the solutions provided,  I tried

 pip install requests and pip install requests --upgrade:

yet when I run my file I still get:

Import Error: No module named requests

I am unable to use requests in PyCharm, so I don't know what's causing this. Can you please help here?

0 votes


Open Cmd or Powershell as Admin.

type pip install requests

then request will be installed

('Here I'm assuming that you are working on system environment not the Virtual Environment .')


answered Nov 28, 2020 by Rohan
• 200 points

Related Questions In Python

0 votes
1 answer

Python Requests module - Import Error: No module named requests

Run with Python 3 from the command ...READ MORE

answered Sep 11, 2020 in Python by Malik Brahimi
0 votes
1 answer
0 votes
2 answers

Python error "ImportError: No module named 'tkinter'"

sudo apt-get install python3-tk Then, >> import tkinter # ...READ MORE

answered Nov 9, 2019 in Python by Icetutor
• 160 points
0 votes
1 answer

Python error "ImportError: No module named SpeechRecognition"

Hi @Hannah, replace  import SpeechRecognition as sr with import speech_recognition ...READ MORE

answered Oct 3, 2019 in Python by Yamini
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,832 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
0 votes
1 answer

Python error "ImportError: No module named pygame.locals"

You need to download and install the ...READ MORE

answered Jun 18, 2019 in Python by Greg
0 votes
1 answer

No module named urllib3

It is possible that either urllib3 is ...READ MORE

answered Jan 24, 2019 in Python by SDeb
• 13,250 points