I'm trying to compile my code

import sys,os
    sys.path.insert(0, '/usr/include')
    import plivo, plivoxml

    auth_id = "Your AUTH_ID"
    auth_token = "Your AUTH_TOKEN"

    p = plivo.RestAPI(auth_id, auth_token)

    params = {
      'to': '2222222222',    # The phone numer to which the call will be placed
      'from' : '1111111111', # The phone number to be used as the caller id
      # answer_url is the URL invoked by Plivo when the outbound call is answered
      # and contains instructions telling Plivo what to do with the call
      'answer_url' : "https://s3.amazonaws.com/static.plivo.com/answer.xml",
      'answer_method' : "GET", # The method used to call the answer_url

      # Example for asynchronous request  
      # callback_url is the URL to which the API response is sent.
      #'callback_url' => "http://myvoiceapp.com/callback/",
      #'callback_method' => "GET" # The method used to notify the callback_url.

    # Make an outbound call and print the response
    response = p.make_call(params)**Error:**

but get error

Python 2.7.13 (default, Jan 19 2017, 14:48:08) 
[GCC 6.3.0 20170124] on linux2
Type "copyright", "credits" or "license()" for more information.
===== RESTART: /home/pi/virtualenvironment/my_new_app/bin/make_calls.py =====

Traceback (most recent call last):
  File "/home/pi/virtualenvironment/my_new_app/bin/make_calls.py", line 4, in <module>
    import plivo, plivoxml
ImportError: No module named plivoxml

Why cant the program find the packages needed to compile the code, are they in the wrong path? I tried to import them from another map where they are saved /usr/include/libxslt /usr/share/man/man3/libxslt.3.gz without luck.


I have installed the neccesary packages using

sudo apt-get install libxslt
sudo apt-get install libxml2

pip install plivo

Packages has this location:

(my_new_app) pi@raspberrypi:~/virtualenvironment/my_new_app/bin $ whereis libxslt
libxslt: /usr/include/libxslt /usr/share/man/man3/libxslt.3.gz

My py. file is located in "/home/pi/virtualenvironment/my_new_app/bin/make_calls.py"

  • 1
    Not really a Pi problem. The module is not in the Python path. – joan Feb 17 '18 at 18:12
  • Any suggestion how to fix it? – ojjaman Feb 18 '18 at 14:53

It looks like you're missing development packages for XML libraries. Try installing them (libxslt-dev and libxml2-dev) and running pip install again.

  • I installed bought packages but I still get error when compiling the code in Python. Could it be that Python and the packages doesn't have the same path? If so, how can i fix it? – ojjaman Feb 19 '18 at 13:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.