Home > No Module > Python Import Site Error

Python Import Site Error


This happens even if there are other preceding subdirectories on sys.path that match the desired package name, but do not include an __init__.py file. How to reproduce it: The scaffold is taken from the tutorials on how to do eclipse plugins. Apr 8 '11 at 20:18 Yes, site.py is located in that folder –Mimminito Apr 10 '11 at 8:53 5 @Mimminito: I'm curious (mildly) why you disappeared for 9 Ignacio's solution worked. –bodacydo Feb 24 '10 at 13:08 The init.py files are required to make Python treat the directories as containing packages; this is done to prevent directories this contact form

Is it a Good UX to keep both star and smiley rating system as filters? the pre-1.4 Django project layout gets into trouble by running manage.py from inside a package, which puts the package directory on sys.path and leads to this double import problem Here's a gist of what I finally learnt: Know the Python Path Knowing about the PYTHONPATH is key to installing and importing third-party packages. Join them; it only takes a minute: Sign up Python import-site error with multiple versions up vote 0 down vote favorite I'm using a shared machine.

Importerror No Module Named Site Python

Note that this was in a cmd or bat file to setup the environment for other tools. Generating a sequence of zeros at compile time Steepest descent/gradient descent as dynamical system Baking at a lower temperature than the recipe calls for Set literal gives different result from set and much more :) Now get 50% off on my ebook for a limited time !

  • To avoid any such interference, you can have separate Virtual environment for each of your applications using Virtual Python Environment builder.
  • The missing __init__.py trap¶ This particular trap applies to 2.x releases, as well as 3.x releases up to and including 3.2.
  • The latter will be ignored by the interpreter if the corresponding source file is missing, so the above renaming of the source file works as intended: $ echo 'from socket import
  • Mathematics tenure-track committees: Mathjobs question more hot questions question feed lang-py about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life
  • Not the answer you're looking for?
  • more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed
  • And by running the activation scripts you make them default.
  • I am not sure if this should be the best way, or jython should be able to find the modules inside the jar as it did in 2.5.3.

Even if there is no initialisation code to run when the package is imported, an empty __init__.py file is still needed for the interpreter to find any modules or subpackages This behavior is not present if I use jython 2.5.3. All of the standard library currently works that way, although some packages may open up their namespaces to third party contributions in future releases (specifically, it is almost certain the

Revision d8cc8aa0acbe+. Importerror No Module Named Site Python Linux Adding this note to help other people that may come to this page with the same problem. –robert Aug 19 '14 at 13:06 | show 1 more comment 14 Answers 14 However, when i started with python -I had a hard time figuring out how to import third-party modules & packages into my program. http://stackoverflow.com/questions/6471388/python-import-site-error-with-multiple-versions That way, inadvertently executing the main module twice becomes harmless.

One particularly surprising way to run afoul of this trap is by using such a name for a script, as this then combines with the previous "executing the main module twice" Gdb Importerror: No Module Named Site share|improve this answer answered Oct 25 '11 at 7:38 cyborg 6,96022151 add a comment| up vote 2 down vote In my mind I have to consider that the foo folder is The submodules are added to the package namespace trap¶ Many users will have experienced the issue of trying to use a submodule when only importing the package that it is in: How can I Improve gameplay for new players, as a new player?

Importerror No Module Named Site Python Linux

This could mess the interpreter, if Python 2.7 is first in the %PATH%, and Python3 is set for PYTHONHOME, for example. –LM.Croisez May 6 at 13:45 | show 5 more comments https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/532383 qgis python share|improve this question edited Mar 23 '15 at 11:11 PolyGeo♦ 39.3k1358149 asked Mar 23 '15 at 10:43 Bárbara Duarte 545418 add a comment| 1 Answer 1 active oldest votes Importerror No Module Named Site Python Consider a simple package layout like the following (I typically use package layouts along these lines in my own projects - a lot of people hate nesting tests inside package directories Importerror No Module Named Site Python Windows Jokes about Monica's haircut Why do neural network researchers care about epochs?

I installed Python into the default location: C:\Python27 Next, to test that Python was installed correctly, I navigated to my Python Directory, and ran the "python" command in the windows cmd weblink Browse other questions tagged python windows module installation environment-variables or ask your own question. By convention, all third-party packages go into Pythonfolder/Lib/site-packages. Much of it applies to earlier versions as well, but I won't be qualifying any of the explanations with version details before 2.6. Importerror: No Module Named Site Ubuntu

Add /home/bodacydo/work/project to either sys.path or $PYTHONPATH. This essay only officially covers Python versions back to Python 2.6. The python.home and sys.path look correct, Lib folder is in the path, the modules are in the folder, and still they fail to import. navigate here share|improve this answer answered Jan 14 at 17:14 Debashish 10511 add a comment| up vote 0 down vote I have an application which relies heavily on Python and have kept up-to-date

How can a nine tailed fox catch its prey? Importerror No Module Named Site Uwsgi Can I only touch other creatures with spells such as Invisibility? This is just one more reason why main modules in more complex applications should be kept fairly minimal - it's generally far more robust to move most of the functionality to

This particular trap has been largely eliminated in Python 3.2 and later.

share|improve this answer answered Jul 26 at 12:14 DigviJay Patil 409415 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign Possibly RelatedOpen Source Android App to Calculate Sunrise Sunset TimeAndroid: Adding Glow Effect to UI elementsOpenCV: Interlacing Two ImagesOpenCV:Convert an Image to GreyScaleOpenCV: Split target image into its red, green and If not then python won't recognise foo as a python package. Importerror: No Module Named Site Django Prior to Python 3.3, filesystem directories, and directories within zipfiles, had to contain an __init__.py in order to be recognised as Python package directories.

In reality, what has happened is that the cached bytecode file from our previous failed import attempt is still present and causing trouble, but when Python tries to display the source Python in Cmd works. The fact that most methods of invoking Python code from the command line break when that code is inside a package, and the two that do work are highly sensitive to his comment is here Read the Docs v: latest Versions latest Downloads pdf htmlzip epub On Read the Docs Project Home Builds Free document hosting provided by Read the Docs.

more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed As described here: http://www.vogella.com/tutorials/EclipsePlugIn/article.html The samplehandler class is the one initializing jython, and the one that generates the error public class SampleHandler extends AbstractHandler { /** * The constructor. */ public However, if a folder in the PythonPath has a file called __init__.py, Python jumps inside it and treats the complete folder as a package. I downloaded the following installer from the Python website: Python 2.7.1 Windows Installer (Windows binary -- does not include source).

For example, if experimenting to learn more about Python's socket module, you may be inclined to call your experimental script socket.py. Half the pentagon! I have the following directory structure: /home/bodacydo /home/bodacydo/work /home/bodacydo/work/project /home/bodacydo/work/project/programs /home/bodacydo/work/project/foo And I am in the directory /home/bodacydo/work/project Now if I type python ./programs/my_python_program.py I instantly get ImportError: No module named Baking at a lower temperature than the recipe calls for How to flood the entire lunar surfaces?

Modules like sys import OK. How do I find out if there is an Esperanto club in my city? Thanks! –jmite Jun 24 '11 at 17:37 Try running virtualenv with python2.7. Does the Many Worlds interpretation of quantum mechanics necessarily imply every world exist?

share|improve this answer answered Apr 16 '11 at 14:12 RenderCase 1,029162 6 And you need to append %PYTHONHOME% to your path variable as well for this to work. –Rishi Sep It looks like you need to make sure you run PYTHONHOME and PYTHONPATH through cygwin -aw to make them Windows paths. The __init__.py trap¶ This is an all new trap added in Python 3.3 as a consequence of fixing the previous trap: if a subdirectory encountered on sys.path as part of Thanks.

How does a jet's throttle actually work? Can I only touch other creatures with spells such as Invisibility? Both these folder had path variable set, and hence there was this issue. If I need to work in a different directory for some reason, well, that's why I also like to have multiple shell sessions open.

On the left tab, go to Advanced system settings. It returns me the following error: ImportError: No module named site When I do 'python -v' I get the following: #installing zipimport hook
import zipimport # builtin #installed zipimport hook #ImportError: