User avatar
mikronauts
Posts: 2705
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Can't find Python.h trying to make wrapper (SOLVED)

Sun Aug 10, 2014 12:14 am

Hi guys,

Dumb question time... where oh where is Python.h?

I tried

apt-get install python-devel

and

apt-get install python2.6-devel

no joy.

As you may guess, I have not used Python in a while - I normally work in C or assembler, however I am trying to create a python library for my "RoboPiLib" (for my RoboPi product).

I have swig compiled and installed, now I just need to build the wrapper :)

Thanks,

Bill
Last edited by mikronauts on Sun Aug 10, 2014 12:45 am, edited 1 time in total.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
mikronauts
Posts: 2705
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Can't find Python.h trying to make wrapper for a C libra

Sun Aug 10, 2014 12:28 am

Some googling showed I should use

sudo apt-get install python-dev

but no joy, it starts to install, but there are a number of broken links.

Same for

sudo apt-get install python2.6-dev
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
mikronauts
Posts: 2705
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Can't find Python.h trying to make wrapper for a C libra

Sun Aug 10, 2014 12:31 am

[email protected] ~/test1/swig-3.0.2 $ sudo apt-get install python-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libexpat1-dev libssl-dev libssl-doc python2.7-dev
The following NEW packages will be installed:
libexpat1-dev libssl-dev libssl-doc python-dev python2.7-dev
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 31.6 MB/31.6 MB of archives.
After this operation, 42.2 MB of additional disk space will be used.
Do you want to continue [Y/n]?Y
Err http://mirrordirector.raspbian.org/raspbian/ wheezy/main libexpat1-dev armhf 2.1.0-1
404 Not Found
Err http://mirrordirector.raspbian.org/raspbian/ wheezy/main libssl-dev armhf 1.0.1e-2+rpi1
404 Not Found
Err http://mirrordirector.raspbian.org/raspbian/ wheezy/main libssl-doc all 1.0.1e-2+rpi1
404 Not Found
Err http://mirrordirector.raspbian.org/raspbian/ wheezy/main python2.7-dev armhf 2.7.3-6
404 Not Found
Failed to fetch http://mirrordirector.raspbian.org/rasp ... _armhf.deb 404 Not Found
Failed to fetch http://mirrordirector.raspbian.org/rasp ... _armhf.deb 404 Not Found
Failed to fetch http://mirrordirector.raspbian.org/rasp ... i1_all.deb 404 Not Found
Failed to fetch http://mirrordirector.raspbian.org/rasp ... _armhf.deb 404 Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
I am doing a "sudo apt-get update" right now, then I will try "sudo apt-get python-dev --fix-missing".

I'll post if I get it working.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
mikronauts
Posts: 2705
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Can't find Python.h trying to make wrapper for a C libra

Sun Aug 10, 2014 12:44 am

That did it!

After the apt-get update, I could apt-get install python-dev, and it installed Python.h in /usr/include/python2.7
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
mikronauts
Posts: 2705
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Can't find Python.h trying to make wrapper (SOLVED)

Sun Aug 10, 2014 3:56 am

I've been able to build my python wrapped library, and it imports fine.

Does not run yet... but that should just be debugging.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
mikronauts
Posts: 2705
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Can't find Python.h trying to make wrapper (SOLVED)

Fri Aug 15, 2014 4:27 am

In case anyone is interested... the library works fine from Python 2.7

I still need to locate the appropriate Python.h for Python3.2, but for now I am happy with 2.7
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
rpdom
Posts: 14483
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Can't find Python.h trying to make wrapper (SOLVED)

Fri Aug 15, 2014 7:02 am

Just for future reference you should always run an apt-get update before running apt-get install or upgrade. This ensure that the list of programs/filenames available for download is up to date and matches what is on the server. Although you probably won't need to run an update if you've already done one that day.

User avatar
mikronauts
Posts: 2705
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Can't find Python.h trying to make wrapper (SOLVED)

Fri Aug 15, 2014 2:03 pm

Thank you.

I ran apt-get update and apt-get upgrade, before that I could not even get the Python.h for 2.7

Now I'll just have to figure out the issue for 3.2, but that is less urgent as 2.7 now works with RoboPi
rpdom wrote:Just for future reference you should always run an apt-get update before running apt-get install or upgrade. This ensure that the list of programs/filenames available for download is up to date and matches what is on the server. Although you probably won't need to run an update if you've already done one that day.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
rpdom
Posts: 14483
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Can't find Python.h trying to make wrapper (SOLVED)

Fri Aug 15, 2014 4:41 pm

Try installing python3.2-dev

User avatar
mikronauts
Posts: 2705
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Can't find Python.h trying to make wrapper (SOLVED)

Sat Aug 16, 2014 12:38 am

Thank you!

That worked right away.
rpdom wrote:Try installing python3.2-dev
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
rpdom
Posts: 14483
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Can't find Python.h trying to make wrapper (SOLVED)

Sat Aug 16, 2014 5:19 am

mikronauts wrote:Thank you!

That worked right away.
:D

A handy tip here. If you're looking for the package that a particular file is in, you can use the search function on the Debian site. Find the package it is in, then install the package of the same name from Raspbian (don't install from the Debian site).

https://www.debian.org/distrib/packages#search_contents

User avatar
mikronauts
Posts: 2705
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Can't find Python.h trying to make wrapper (SOLVED)

Sat Aug 16, 2014 2:45 pm

Great tip, which will help me in the future - thanks!

In the past few years, I tended to use Ubuntu mostly due to the inclusion of non-free nVidia drivers, before that Mandrake and RedHat... but now with Pi etc I am getting more and more into Debian, and I am starting to like its more 'lean' nature.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

krishnaiah.vv
Posts: 19
Joined: Wed Jun 24, 2015 7:34 am

Re: Can't find Python.h trying to make wrapper (SOLVED)

Wed Jun 24, 2015 9:35 am

Hi,

I understand that "sudo apt-get update" needs internet connection for updating packages.
But, do u have an idea how we can install the python3-dev by downloading them on windows machine?

For some reasons, I am not allowed to connect to Internet. :( .

Thank you
Krish

Return to “Python”