“No module named _struct” after manually building and installing python 2.6 Unicorn Meta...

Why did C use the -> operator instead of reusing the . operator?

Can I criticise the more senior developers around me for not writing clean code?

Multiple options vs single option UI

Does Feeblemind produce an ongoing magical effect that can be dispelled?

Multiple fireplaces in an apartment building?

Retract an already submitted recommendation letter (written for an undergrad student)

What is /etc/mtab in Linux?

"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"

Israeli soda type drink

Do I need to protect SFP ports and optics from dust/contaminants? If so, how?

Could moose/elk survive in the Amazon forest?

Trumpet valves, lengths, and pitch

How long after the last departure shall the airport stay open for an emergency return?

How to not starve gigantic beasts

How to avoid introduction cliches

Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?

"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?

Is accepting an invalid credit card number a security issue?

Will I lose my paid in full property

Has a Nobel Peace laureate ever been accused of war crimes?

Split coins into combinations of different denominations

What is ls Largest Number Formed by only moving two sticks in 508?

Mistake in years of experience in resume?

Is Electric Central Heating worth it if using Solar Panels?



“No module named _struct” after manually building and installing python 2.6



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manaraproblems of python installation“ImportError: No module named _struct” configuring python-minimalError from install file: “No module named: _struct”Two versions of Python in my Ubuntu 12.04“ImportError: No module named XKit.xutils” while removing nvidia-currentHow to uninstall .deb python module“ImportError: No module named _struct” configuring python-minimalMySQL Installation Issues on Ubuntu 15.04Installed library using checkinstall which created a package named “python” and causes dependency issuesCan't install software because “No module named 'debconf'” error in apt/dpkgE: Sub-process /usr/bin/dpkg returned an error code (1) when try to execute apt-get install python3-pexpectProblem when installing python-lldb-5.0Recovering from badly damaged package system (dpkg+python+???)Building initial module for 4.15.0-28-generic hangs out





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







5















running Ubuntu 12.04, I had the usual python 2.7 in place .



I needed python 2.6 , so I downloaded the source and did



./configure
make
sudo make install


A mistake, as I did not want to replace my system-wide python .
Now some programs stopped working , e.g. update-manager with



ImportError: No module named gi.repository


I used update-alternatives to make python 2.7 default again, but many python applications still won't start up because of some missing modules .



Can someone give a hint what happened and what the best way to fix it would be?



Thanks in advance.



Edit :



I could get some functionality of apt-get to work by setting my own hard link from /etc/python to /etc/python2.7 .
( So I guess using update-alternatives really did not do much good eithe. )
I did a dist-upgrade , which basically worked, but a lot of the package managing via apt-get is still broken.
In particular, a problem with python-minimal prevents many other installations of packages I wanted to do .



Setting up python-minimal (2.7.3-0ubuntu7) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/compileall.py", line 16, in <module>
import struct
File "/usr/local/lib/python2.7/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct
dpkg: error processing python-minimal (--configure):
subprocess installed post-installation script returned error exit status 255


PS:
Building 2.7 from source always did exit (also before dist-ugprade or update-alternatives) with



make: *** [libinstall] Error 1


Currently, on make , there are more issues (" Python build finished, but the necessary bits to build these modules were not found:
_bsddb bsddb185 bz2

dl imageop sunaudiodev

To find the necessary bits, look in setup.py in detect_modules() for the module's name.
")



As this is a little over my head , I guess I am just better off with a fresh install from scratch .










share|improve this question




















  • 2





    Possible duplicate of "ImportError: No module named _struct" configuring python-minimal

    – Braiam
    11 hours ago


















5















running Ubuntu 12.04, I had the usual python 2.7 in place .



I needed python 2.6 , so I downloaded the source and did



./configure
make
sudo make install


A mistake, as I did not want to replace my system-wide python .
Now some programs stopped working , e.g. update-manager with



ImportError: No module named gi.repository


I used update-alternatives to make python 2.7 default again, but many python applications still won't start up because of some missing modules .



Can someone give a hint what happened and what the best way to fix it would be?



Thanks in advance.



Edit :



I could get some functionality of apt-get to work by setting my own hard link from /etc/python to /etc/python2.7 .
( So I guess using update-alternatives really did not do much good eithe. )
I did a dist-upgrade , which basically worked, but a lot of the package managing via apt-get is still broken.
In particular, a problem with python-minimal prevents many other installations of packages I wanted to do .



Setting up python-minimal (2.7.3-0ubuntu7) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/compileall.py", line 16, in <module>
import struct
File "/usr/local/lib/python2.7/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct
dpkg: error processing python-minimal (--configure):
subprocess installed post-installation script returned error exit status 255


PS:
Building 2.7 from source always did exit (also before dist-ugprade or update-alternatives) with



make: *** [libinstall] Error 1


Currently, on make , there are more issues (" Python build finished, but the necessary bits to build these modules were not found:
_bsddb bsddb185 bz2

dl imageop sunaudiodev

To find the necessary bits, look in setup.py in detect_modules() for the module's name.
")



As this is a little over my head , I guess I am just better off with a fresh install from scratch .










share|improve this question




















  • 2





    Possible duplicate of "ImportError: No module named _struct" configuring python-minimal

    – Braiam
    11 hours ago














5












5








5


5






running Ubuntu 12.04, I had the usual python 2.7 in place .



I needed python 2.6 , so I downloaded the source and did



./configure
make
sudo make install


A mistake, as I did not want to replace my system-wide python .
Now some programs stopped working , e.g. update-manager with



ImportError: No module named gi.repository


I used update-alternatives to make python 2.7 default again, but many python applications still won't start up because of some missing modules .



Can someone give a hint what happened and what the best way to fix it would be?



Thanks in advance.



Edit :



I could get some functionality of apt-get to work by setting my own hard link from /etc/python to /etc/python2.7 .
( So I guess using update-alternatives really did not do much good eithe. )
I did a dist-upgrade , which basically worked, but a lot of the package managing via apt-get is still broken.
In particular, a problem with python-minimal prevents many other installations of packages I wanted to do .



Setting up python-minimal (2.7.3-0ubuntu7) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/compileall.py", line 16, in <module>
import struct
File "/usr/local/lib/python2.7/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct
dpkg: error processing python-minimal (--configure):
subprocess installed post-installation script returned error exit status 255


PS:
Building 2.7 from source always did exit (also before dist-ugprade or update-alternatives) with



make: *** [libinstall] Error 1


Currently, on make , there are more issues (" Python build finished, but the necessary bits to build these modules were not found:
_bsddb bsddb185 bz2

dl imageop sunaudiodev

To find the necessary bits, look in setup.py in detect_modules() for the module's name.
")



As this is a little over my head , I guess I am just better off with a fresh install from scratch .










share|improve this question
















running Ubuntu 12.04, I had the usual python 2.7 in place .



I needed python 2.6 , so I downloaded the source and did



./configure
make
sudo make install


A mistake, as I did not want to replace my system-wide python .
Now some programs stopped working , e.g. update-manager with



ImportError: No module named gi.repository


I used update-alternatives to make python 2.7 default again, but many python applications still won't start up because of some missing modules .



Can someone give a hint what happened and what the best way to fix it would be?



Thanks in advance.



Edit :



I could get some functionality of apt-get to work by setting my own hard link from /etc/python to /etc/python2.7 .
( So I guess using update-alternatives really did not do much good eithe. )
I did a dist-upgrade , which basically worked, but a lot of the package managing via apt-get is still broken.
In particular, a problem with python-minimal prevents many other installations of packages I wanted to do .



Setting up python-minimal (2.7.3-0ubuntu7) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/compileall.py", line 16, in <module>
import struct
File "/usr/local/lib/python2.7/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct
dpkg: error processing python-minimal (--configure):
subprocess installed post-installation script returned error exit status 255


PS:
Building 2.7 from source always did exit (also before dist-ugprade or update-alternatives) with



make: *** [libinstall] Error 1


Currently, on make , there are more issues (" Python build finished, but the necessary bits to build these modules were not found:
_bsddb bsddb185 bz2

dl imageop sunaudiodev

To find the necessary bits, look in setup.py in detect_modules() for the module's name.
")



As this is a little over my head , I guess I am just better off with a fresh install from scratch .







dpkg






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 11 hours ago









Braiam

52.7k20139225




52.7k20139225










asked Mar 19 '13 at 16:41









zm0zm0

126114




126114








  • 2





    Possible duplicate of "ImportError: No module named _struct" configuring python-minimal

    – Braiam
    11 hours ago














  • 2





    Possible duplicate of "ImportError: No module named _struct" configuring python-minimal

    – Braiam
    11 hours ago








2




2





Possible duplicate of "ImportError: No module named _struct" configuring python-minimal

– Braiam
11 hours ago





Possible duplicate of "ImportError: No module named _struct" configuring python-minimal

– Braiam
11 hours ago










4 Answers
4






active

oldest

votes


















5














I had a similar problem when I downgraded from debian/Testing to debian/Stable recently. I guess somewhere in the process, python modules got corrupted. Purging and reinstalling python was, as it was pointed out, a bit draconian. Thankfully, I came across the following
http://ubuntuforums.org/showthread.php?t=735693



Following this suggestion, I tried the command



for pkg in `dpkg --get-selections | egrep -v 'deinstall' | egrep python | awk '{print $1}'`; do  apt-get -y --force-yes install --reinstall $pkg ; done


to reinstall anything that has python in its name, and that solved the problem.






share|improve this answer
























  • This saved me... had to run it a couple of times until all package errors were resolved. Thanks!!!

    – Alan
    Mar 16 '17 at 18:19











  • I get an infinite loop with unmet dependencies errors when executing the code provided. Can I force it do execute anyway?

    – kleinfreund
    Apr 7 '17 at 15:15





















2














Your python 2.6 install has probably changed lots of settings and paths.



Your best bet is to reinstall the default python interpreter



sudo apt-get --reinstall install python python-support


I can't test it, but I hope that it works. Good luck.



If it doesn't work the only other idea that I have is to install python 2.7 from source, and afterwards trying to reinstall the default one again.






share|improve this answer


























  • --reinstall sounded good but did not work , in fact due to a python error that came up in the process of running apt-get . Thanks anyways , though

    – zm0
    Mar 19 '13 at 17:40











  • Edited the answer, try to complie 2.7 from source and re-do the reinstall vodoo.

    – Javier Rivera
    Mar 19 '13 at 18:06



















1














I ran into essentially the same issue, but for python-minimal 2.7.11-1.



cat /var/lib/dpkg/info/python-minimal.postinst



You should get something like this:



#! /bin/sh
set -e

python2.7 -m compileall /usr/share/python/ >/dev/null


Run the command without redirect to >/dev/null (edit the file, or: sudo python2.7 -m compileall /usr/share/python/). This will show you where post installation configuration is failing.



Ex:



Listing /usr/share/python/penemue/lib/python2.7/site-packages/gevent 
Compiling /usr/share/python/penemue/lib/python2.7/site-packages/gevent/_socket3.py ...
File "/usr/share/python/penemue/lib/python2.7/site-packages/gevent/_socket3.py", line 183
def makefile(self, mode="r", buffering=None, *,
^
SyntaxError: invalid syntax


In my case, it was a custom python package (built using dh-virtualenv) that lived under /usr/share/python. I had to run dpkg -P penemue and ultimately remove the /usr/share/python/penemue directory. I might have been able to just move the /usr/share/python/penemue directory out of the way.



Once I got rid of the bad code, running sudo apt-get install -f resolved the issues.






share|improve this answer































    0














    My guess is that you accidentally got overwrote the default python directory (somehow) and 2.6 is incompatible with what update manager/apps need.



    Try sudo apt-get purge python2 then sudo apt-get install python2. This should purge python from your system and reinstall it, making it the default Python again.



    Only other idea is that you got a bad source for 2.6 and it as such made a bad install that wasn't bad enough to be detected by make???






    share|improve this answer



















    • 1





      Doing apt-get purge python will remove a LOT of packages and components which I would have to re-install manually after re-installing python (?) . Would like to keep that as a last resort only ..

      – zm0
      Mar 19 '13 at 16:58











    • true. Though, if just reinstalling 2.7 via apt-get --reinstall install python2 python2-support doesn't work, it will be the best bet to go with.

      – RPiAwesomeness
      Mar 19 '13 at 17:01











    • Yes, --reinstall does not work . When purgeing, something went wrong, too . At the moment, I cannot use apt-get, because of (python) errors e.g. installing gtk components like checkbox , etc. I will now try to reset python - as this still seems to be the core of the problem - somehow manually.

      – zm0
      Mar 19 '13 at 17:40














    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f270011%2fno-module-named-struct-after-manually-building-and-installing-python-2-6%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    I had a similar problem when I downgraded from debian/Testing to debian/Stable recently. I guess somewhere in the process, python modules got corrupted. Purging and reinstalling python was, as it was pointed out, a bit draconian. Thankfully, I came across the following
    http://ubuntuforums.org/showthread.php?t=735693



    Following this suggestion, I tried the command



    for pkg in `dpkg --get-selections | egrep -v 'deinstall' | egrep python | awk '{print $1}'`; do  apt-get -y --force-yes install --reinstall $pkg ; done


    to reinstall anything that has python in its name, and that solved the problem.






    share|improve this answer
























    • This saved me... had to run it a couple of times until all package errors were resolved. Thanks!!!

      – Alan
      Mar 16 '17 at 18:19











    • I get an infinite loop with unmet dependencies errors when executing the code provided. Can I force it do execute anyway?

      – kleinfreund
      Apr 7 '17 at 15:15


















    5














    I had a similar problem when I downgraded from debian/Testing to debian/Stable recently. I guess somewhere in the process, python modules got corrupted. Purging and reinstalling python was, as it was pointed out, a bit draconian. Thankfully, I came across the following
    http://ubuntuforums.org/showthread.php?t=735693



    Following this suggestion, I tried the command



    for pkg in `dpkg --get-selections | egrep -v 'deinstall' | egrep python | awk '{print $1}'`; do  apt-get -y --force-yes install --reinstall $pkg ; done


    to reinstall anything that has python in its name, and that solved the problem.






    share|improve this answer
























    • This saved me... had to run it a couple of times until all package errors were resolved. Thanks!!!

      – Alan
      Mar 16 '17 at 18:19











    • I get an infinite loop with unmet dependencies errors when executing the code provided. Can I force it do execute anyway?

      – kleinfreund
      Apr 7 '17 at 15:15
















    5












    5








    5







    I had a similar problem when I downgraded from debian/Testing to debian/Stable recently. I guess somewhere in the process, python modules got corrupted. Purging and reinstalling python was, as it was pointed out, a bit draconian. Thankfully, I came across the following
    http://ubuntuforums.org/showthread.php?t=735693



    Following this suggestion, I tried the command



    for pkg in `dpkg --get-selections | egrep -v 'deinstall' | egrep python | awk '{print $1}'`; do  apt-get -y --force-yes install --reinstall $pkg ; done


    to reinstall anything that has python in its name, and that solved the problem.






    share|improve this answer













    I had a similar problem when I downgraded from debian/Testing to debian/Stable recently. I guess somewhere in the process, python modules got corrupted. Purging and reinstalling python was, as it was pointed out, a bit draconian. Thankfully, I came across the following
    http://ubuntuforums.org/showthread.php?t=735693



    Following this suggestion, I tried the command



    for pkg in `dpkg --get-selections | egrep -v 'deinstall' | egrep python | awk '{print $1}'`; do  apt-get -y --force-yes install --reinstall $pkg ; done


    to reinstall anything that has python in its name, and that solved the problem.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Dec 19 '13 at 19:09









    SorooshSoroosh

    15111




    15111













    • This saved me... had to run it a couple of times until all package errors were resolved. Thanks!!!

      – Alan
      Mar 16 '17 at 18:19











    • I get an infinite loop with unmet dependencies errors when executing the code provided. Can I force it do execute anyway?

      – kleinfreund
      Apr 7 '17 at 15:15





















    • This saved me... had to run it a couple of times until all package errors were resolved. Thanks!!!

      – Alan
      Mar 16 '17 at 18:19











    • I get an infinite loop with unmet dependencies errors when executing the code provided. Can I force it do execute anyway?

      – kleinfreund
      Apr 7 '17 at 15:15



















    This saved me... had to run it a couple of times until all package errors were resolved. Thanks!!!

    – Alan
    Mar 16 '17 at 18:19





    This saved me... had to run it a couple of times until all package errors were resolved. Thanks!!!

    – Alan
    Mar 16 '17 at 18:19













    I get an infinite loop with unmet dependencies errors when executing the code provided. Can I force it do execute anyway?

    – kleinfreund
    Apr 7 '17 at 15:15







    I get an infinite loop with unmet dependencies errors when executing the code provided. Can I force it do execute anyway?

    – kleinfreund
    Apr 7 '17 at 15:15















    2














    Your python 2.6 install has probably changed lots of settings and paths.



    Your best bet is to reinstall the default python interpreter



    sudo apt-get --reinstall install python python-support


    I can't test it, but I hope that it works. Good luck.



    If it doesn't work the only other idea that I have is to install python 2.7 from source, and afterwards trying to reinstall the default one again.






    share|improve this answer


























    • --reinstall sounded good but did not work , in fact due to a python error that came up in the process of running apt-get . Thanks anyways , though

      – zm0
      Mar 19 '13 at 17:40











    • Edited the answer, try to complie 2.7 from source and re-do the reinstall vodoo.

      – Javier Rivera
      Mar 19 '13 at 18:06
















    2














    Your python 2.6 install has probably changed lots of settings and paths.



    Your best bet is to reinstall the default python interpreter



    sudo apt-get --reinstall install python python-support


    I can't test it, but I hope that it works. Good luck.



    If it doesn't work the only other idea that I have is to install python 2.7 from source, and afterwards trying to reinstall the default one again.






    share|improve this answer


























    • --reinstall sounded good but did not work , in fact due to a python error that came up in the process of running apt-get . Thanks anyways , though

      – zm0
      Mar 19 '13 at 17:40











    • Edited the answer, try to complie 2.7 from source and re-do the reinstall vodoo.

      – Javier Rivera
      Mar 19 '13 at 18:06














    2












    2








    2







    Your python 2.6 install has probably changed lots of settings and paths.



    Your best bet is to reinstall the default python interpreter



    sudo apt-get --reinstall install python python-support


    I can't test it, but I hope that it works. Good luck.



    If it doesn't work the only other idea that I have is to install python 2.7 from source, and afterwards trying to reinstall the default one again.






    share|improve this answer















    Your python 2.6 install has probably changed lots of settings and paths.



    Your best bet is to reinstall the default python interpreter



    sudo apt-get --reinstall install python python-support


    I can't test it, but I hope that it works. Good luck.



    If it doesn't work the only other idea that I have is to install python 2.7 from source, and afterwards trying to reinstall the default one again.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 19 '13 at 18:06

























    answered Mar 19 '13 at 16:47









    Javier RiveraJavier Rivera

    30.2k978101




    30.2k978101













    • --reinstall sounded good but did not work , in fact due to a python error that came up in the process of running apt-get . Thanks anyways , though

      – zm0
      Mar 19 '13 at 17:40











    • Edited the answer, try to complie 2.7 from source and re-do the reinstall vodoo.

      – Javier Rivera
      Mar 19 '13 at 18:06



















    • --reinstall sounded good but did not work , in fact due to a python error that came up in the process of running apt-get . Thanks anyways , though

      – zm0
      Mar 19 '13 at 17:40











    • Edited the answer, try to complie 2.7 from source and re-do the reinstall vodoo.

      – Javier Rivera
      Mar 19 '13 at 18:06

















    --reinstall sounded good but did not work , in fact due to a python error that came up in the process of running apt-get . Thanks anyways , though

    – zm0
    Mar 19 '13 at 17:40





    --reinstall sounded good but did not work , in fact due to a python error that came up in the process of running apt-get . Thanks anyways , though

    – zm0
    Mar 19 '13 at 17:40













    Edited the answer, try to complie 2.7 from source and re-do the reinstall vodoo.

    – Javier Rivera
    Mar 19 '13 at 18:06





    Edited the answer, try to complie 2.7 from source and re-do the reinstall vodoo.

    – Javier Rivera
    Mar 19 '13 at 18:06











    1














    I ran into essentially the same issue, but for python-minimal 2.7.11-1.



    cat /var/lib/dpkg/info/python-minimal.postinst



    You should get something like this:



    #! /bin/sh
    set -e

    python2.7 -m compileall /usr/share/python/ >/dev/null


    Run the command without redirect to >/dev/null (edit the file, or: sudo python2.7 -m compileall /usr/share/python/). This will show you where post installation configuration is failing.



    Ex:



    Listing /usr/share/python/penemue/lib/python2.7/site-packages/gevent 
    Compiling /usr/share/python/penemue/lib/python2.7/site-packages/gevent/_socket3.py ...
    File "/usr/share/python/penemue/lib/python2.7/site-packages/gevent/_socket3.py", line 183
    def makefile(self, mode="r", buffering=None, *,
    ^
    SyntaxError: invalid syntax


    In my case, it was a custom python package (built using dh-virtualenv) that lived under /usr/share/python. I had to run dpkg -P penemue and ultimately remove the /usr/share/python/penemue directory. I might have been able to just move the /usr/share/python/penemue directory out of the way.



    Once I got rid of the bad code, running sudo apt-get install -f resolved the issues.






    share|improve this answer




























      1














      I ran into essentially the same issue, but for python-minimal 2.7.11-1.



      cat /var/lib/dpkg/info/python-minimal.postinst



      You should get something like this:



      #! /bin/sh
      set -e

      python2.7 -m compileall /usr/share/python/ >/dev/null


      Run the command without redirect to >/dev/null (edit the file, or: sudo python2.7 -m compileall /usr/share/python/). This will show you where post installation configuration is failing.



      Ex:



      Listing /usr/share/python/penemue/lib/python2.7/site-packages/gevent 
      Compiling /usr/share/python/penemue/lib/python2.7/site-packages/gevent/_socket3.py ...
      File "/usr/share/python/penemue/lib/python2.7/site-packages/gevent/_socket3.py", line 183
      def makefile(self, mode="r", buffering=None, *,
      ^
      SyntaxError: invalid syntax


      In my case, it was a custom python package (built using dh-virtualenv) that lived under /usr/share/python. I had to run dpkg -P penemue and ultimately remove the /usr/share/python/penemue directory. I might have been able to just move the /usr/share/python/penemue directory out of the way.



      Once I got rid of the bad code, running sudo apt-get install -f resolved the issues.






      share|improve this answer


























        1












        1








        1







        I ran into essentially the same issue, but for python-minimal 2.7.11-1.



        cat /var/lib/dpkg/info/python-minimal.postinst



        You should get something like this:



        #! /bin/sh
        set -e

        python2.7 -m compileall /usr/share/python/ >/dev/null


        Run the command without redirect to >/dev/null (edit the file, or: sudo python2.7 -m compileall /usr/share/python/). This will show you where post installation configuration is failing.



        Ex:



        Listing /usr/share/python/penemue/lib/python2.7/site-packages/gevent 
        Compiling /usr/share/python/penemue/lib/python2.7/site-packages/gevent/_socket3.py ...
        File "/usr/share/python/penemue/lib/python2.7/site-packages/gevent/_socket3.py", line 183
        def makefile(self, mode="r", buffering=None, *,
        ^
        SyntaxError: invalid syntax


        In my case, it was a custom python package (built using dh-virtualenv) that lived under /usr/share/python. I had to run dpkg -P penemue and ultimately remove the /usr/share/python/penemue directory. I might have been able to just move the /usr/share/python/penemue directory out of the way.



        Once I got rid of the bad code, running sudo apt-get install -f resolved the issues.






        share|improve this answer













        I ran into essentially the same issue, but for python-minimal 2.7.11-1.



        cat /var/lib/dpkg/info/python-minimal.postinst



        You should get something like this:



        #! /bin/sh
        set -e

        python2.7 -m compileall /usr/share/python/ >/dev/null


        Run the command without redirect to >/dev/null (edit the file, or: sudo python2.7 -m compileall /usr/share/python/). This will show you where post installation configuration is failing.



        Ex:



        Listing /usr/share/python/penemue/lib/python2.7/site-packages/gevent 
        Compiling /usr/share/python/penemue/lib/python2.7/site-packages/gevent/_socket3.py ...
        File "/usr/share/python/penemue/lib/python2.7/site-packages/gevent/_socket3.py", line 183
        def makefile(self, mode="r", buffering=None, *,
        ^
        SyntaxError: invalid syntax


        In my case, it was a custom python package (built using dh-virtualenv) that lived under /usr/share/python. I had to run dpkg -P penemue and ultimately remove the /usr/share/python/penemue directory. I might have been able to just move the /usr/share/python/penemue directory out of the way.



        Once I got rid of the bad code, running sudo apt-get install -f resolved the issues.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jun 16 '16 at 13:50









        ytjohnytjohn

        3011310




        3011310























            0














            My guess is that you accidentally got overwrote the default python directory (somehow) and 2.6 is incompatible with what update manager/apps need.



            Try sudo apt-get purge python2 then sudo apt-get install python2. This should purge python from your system and reinstall it, making it the default Python again.



            Only other idea is that you got a bad source for 2.6 and it as such made a bad install that wasn't bad enough to be detected by make???






            share|improve this answer



















            • 1





              Doing apt-get purge python will remove a LOT of packages and components which I would have to re-install manually after re-installing python (?) . Would like to keep that as a last resort only ..

              – zm0
              Mar 19 '13 at 16:58











            • true. Though, if just reinstalling 2.7 via apt-get --reinstall install python2 python2-support doesn't work, it will be the best bet to go with.

              – RPiAwesomeness
              Mar 19 '13 at 17:01











            • Yes, --reinstall does not work . When purgeing, something went wrong, too . At the moment, I cannot use apt-get, because of (python) errors e.g. installing gtk components like checkbox , etc. I will now try to reset python - as this still seems to be the core of the problem - somehow manually.

              – zm0
              Mar 19 '13 at 17:40


















            0














            My guess is that you accidentally got overwrote the default python directory (somehow) and 2.6 is incompatible with what update manager/apps need.



            Try sudo apt-get purge python2 then sudo apt-get install python2. This should purge python from your system and reinstall it, making it the default Python again.



            Only other idea is that you got a bad source for 2.6 and it as such made a bad install that wasn't bad enough to be detected by make???






            share|improve this answer



















            • 1





              Doing apt-get purge python will remove a LOT of packages and components which I would have to re-install manually after re-installing python (?) . Would like to keep that as a last resort only ..

              – zm0
              Mar 19 '13 at 16:58











            • true. Though, if just reinstalling 2.7 via apt-get --reinstall install python2 python2-support doesn't work, it will be the best bet to go with.

              – RPiAwesomeness
              Mar 19 '13 at 17:01











            • Yes, --reinstall does not work . When purgeing, something went wrong, too . At the moment, I cannot use apt-get, because of (python) errors e.g. installing gtk components like checkbox , etc. I will now try to reset python - as this still seems to be the core of the problem - somehow manually.

              – zm0
              Mar 19 '13 at 17:40
















            0












            0








            0







            My guess is that you accidentally got overwrote the default python directory (somehow) and 2.6 is incompatible with what update manager/apps need.



            Try sudo apt-get purge python2 then sudo apt-get install python2. This should purge python from your system and reinstall it, making it the default Python again.



            Only other idea is that you got a bad source for 2.6 and it as such made a bad install that wasn't bad enough to be detected by make???






            share|improve this answer













            My guess is that you accidentally got overwrote the default python directory (somehow) and 2.6 is incompatible with what update manager/apps need.



            Try sudo apt-get purge python2 then sudo apt-get install python2. This should purge python from your system and reinstall it, making it the default Python again.



            Only other idea is that you got a bad source for 2.6 and it as such made a bad install that wasn't bad enough to be detected by make???







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 19 '13 at 16:47









            RPiAwesomenessRPiAwesomeness

            6,591196197




            6,591196197








            • 1





              Doing apt-get purge python will remove a LOT of packages and components which I would have to re-install manually after re-installing python (?) . Would like to keep that as a last resort only ..

              – zm0
              Mar 19 '13 at 16:58











            • true. Though, if just reinstalling 2.7 via apt-get --reinstall install python2 python2-support doesn't work, it will be the best bet to go with.

              – RPiAwesomeness
              Mar 19 '13 at 17:01











            • Yes, --reinstall does not work . When purgeing, something went wrong, too . At the moment, I cannot use apt-get, because of (python) errors e.g. installing gtk components like checkbox , etc. I will now try to reset python - as this still seems to be the core of the problem - somehow manually.

              – zm0
              Mar 19 '13 at 17:40
















            • 1





              Doing apt-get purge python will remove a LOT of packages and components which I would have to re-install manually after re-installing python (?) . Would like to keep that as a last resort only ..

              – zm0
              Mar 19 '13 at 16:58











            • true. Though, if just reinstalling 2.7 via apt-get --reinstall install python2 python2-support doesn't work, it will be the best bet to go with.

              – RPiAwesomeness
              Mar 19 '13 at 17:01











            • Yes, --reinstall does not work . When purgeing, something went wrong, too . At the moment, I cannot use apt-get, because of (python) errors e.g. installing gtk components like checkbox , etc. I will now try to reset python - as this still seems to be the core of the problem - somehow manually.

              – zm0
              Mar 19 '13 at 17:40










            1




            1





            Doing apt-get purge python will remove a LOT of packages and components which I would have to re-install manually after re-installing python (?) . Would like to keep that as a last resort only ..

            – zm0
            Mar 19 '13 at 16:58





            Doing apt-get purge python will remove a LOT of packages and components which I would have to re-install manually after re-installing python (?) . Would like to keep that as a last resort only ..

            – zm0
            Mar 19 '13 at 16:58













            true. Though, if just reinstalling 2.7 via apt-get --reinstall install python2 python2-support doesn't work, it will be the best bet to go with.

            – RPiAwesomeness
            Mar 19 '13 at 17:01





            true. Though, if just reinstalling 2.7 via apt-get --reinstall install python2 python2-support doesn't work, it will be the best bet to go with.

            – RPiAwesomeness
            Mar 19 '13 at 17:01













            Yes, --reinstall does not work . When purgeing, something went wrong, too . At the moment, I cannot use apt-get, because of (python) errors e.g. installing gtk components like checkbox , etc. I will now try to reset python - as this still seems to be the core of the problem - somehow manually.

            – zm0
            Mar 19 '13 at 17:40







            Yes, --reinstall does not work . When purgeing, something went wrong, too . At the moment, I cannot use apt-get, because of (python) errors e.g. installing gtk components like checkbox , etc. I will now try to reset python - as this still seems to be the core of the problem - somehow manually.

            – zm0
            Mar 19 '13 at 17:40




















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f270011%2fno-module-named-struct-after-manually-building-and-installing-python-2-6%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

            Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

            Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...