No Module Named Python Error
Contents |
here for a quick overview of the
Importerror: No Module Named Pycharm
site Help Center Detailed answers to any questions you might have python importerror cannot import name Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business
$pythonpath
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like python importerror no module named site you, helping each other. Join them; it only takes a minute: Sign up Python import error: 'No module named' does exist up vote 13 down vote favorite 3 I am getting this stack trace when I start pyramid pserve: % python $(which pserve) ../etc/development.ini Traceback (most recent call last): File "/home/hughdbrown/.local/bin/pserve", line 9, in
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business
__init__.py File
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation
Import Error Python Windows
Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like sys.path python you, helping each other. Join them; it only takes a minute: Sign up Win7 (x64) - Python error - “ImportError: No module named lxml” up vote 0 down vote favorite I'm fairly new to python, but can't http://stackoverflow.com/questions/23417941/python-import-error-no-module-named-does-exist seem to get my head around this error - have found posts with similar issues, but none of the responses have helped. I'm running Python 3.4.0 and have installed a module called lxml. I wrote some code which starts from lxml import html This runs perfectly well from the python.exe interface, and the module can be used to succesfully import and parse XML. However, if I save the script as a *.py file, and try to http://stackoverflow.com/questions/39583002/win7-x64-python-error-importerror-no-module-named-lxml call it from a cmd.exe prompt, I get the ImportError: No module named lxml error. Python is within C:\Python34, and the relevant module is located in C:\Python34\Lib\site-packages\lxml, which contains the required __init__.py file. I've checked sys.path which, amongst others, holds C:\\Python34\\lib\\site-packages The double-backslashes and lowercase 'l' in 'lib' shouldn't make a difference, should it? All listed paths appear to have double-backslashes instead of single. I did attempt to add the path with an uppercase 'L' using sys.path.insert(1, 'C:\Python34\Lib\site-packages') which subsequently appeared as a seperate path, however did not resolve the issue. Additionally, I replaced the first line of my script with import sys sys.path.append('C:\Python34\Lib\site-packages') which appeared to attempt to read the required __init__.py file (progress!!!), but then gave the following error: ImportError: Module use of python34.dll conflicts with this version of Python, so I probably won't pursue this avenue, unless it is of relevance. Any idea what I'm doing wrong with regards to ImportError: No module named lxml? python windows-7 lxml importerror share|improve this question asked Sep 19 at 22:26 MO75 11 You are running the code with the wrong interpreter –Padraic Cunningham Sep 19 at 23:06 @Padraic - thanks, but I don't think that this is the case. When I execute 'Python' at the command line, the expected (and correct) version or 3.4.0 is returned. –MO75 Sep 20 at
started with python -I had a hard time figuring out how to import third-party modules & packages into my program. Here's a http://knowpapa.com/import/ gist of what I finally learnt: Know the Python Path Knowing about the PYTHONPATH is key to installing and importing third-party packages. When an import command is passed, http://gis.stackexchange.com/questions/85408/debugging-importerror-no-module-named-arcpy python looks for the module/package in a list of places. The default path(s) where python would search for modules can be found out by: import sys print sys.path no module For my computer it gives me the the following paths: [", ‘C:\\Python27\\Lib\\idlelib', ‘C:\\Windows\\system32\\python27.zip', ‘C:\\Python27\\DLLs', ‘C:\\Python27\\lib', ‘C:\\Python27\\lib\\plat-win', ‘C:\\Python27\\lib\\lib-tk', ‘C:\\Python27', ‘C:\\Python27\\lib\\site-packages'] Starters would do good to install or add modules in one of these paths. If you get this wrong, you will get an error like: ImportError: No module named "foo" . By convention, all third-party packages go into no module named Pythonfolder/Lib/site-packages. Importing Module or Importing packages ? When you add a third-party module to your python library, remember that simply dumping a folder with bunch of .py files will not make it a package. When you use the import command, python does not look inside folders, even if the folders are located in the PYTHONPATH. 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. Changing the Pythonpath If you want to add packages in any other directory (other than the python paths listed above) - you will have to first export the python path in your code with: PYTHONPATH=$PYTHONPATH:C/Your new path/yournewmodulefolder Virtual Environment Builder Suppose you build several applications in your Python environment where one of your application requires version 1 of PackageX, while another application of yours requires version 2 of PackageX. If you try placing both these version in the same folder (say site-package), you are in for some trouble
Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Geographic Information Systems Questions Tags Users Badges Unanswered Ask Question _ Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Debugging ImportError: No module named arcpy? up vote 3 down vote favorite 1 I have written a script and am trying to run it in Python IDLE 2.7.6. I first try to import arcpy, but I get an error message saying "ImportError: No module named arcpy". Why doesn't it work? I'm working off ArcGIS 10.2 for Desktop. arcpy arcgis-10.2 idle share|improve this question edited Jul 29 '15 at 9:55 PolyGeo♦ 39.3k1358148 asked Feb 4 '14 at 23:47 model_help 63116 2 You have to ensure that the arcpy module is within your path/pythonpath environment variables - I believe this should be taken care of if it is installed correctly. –dklassen Feb 4 '14 at 23:58 add a comment| 3 Answers 3 active oldest votes up vote 5 down vote accepted This error is discussed near the bottom of the Importing ArcPy documentation page where there are some additional notes about ArcGIS 10.2.1 (if that is the precise version that you are using). share|improve this answer edited Jul 29 '15 at 9:51 answered Feb 5 '14 at 0:43 PolyGeo♦ 39.3k1358148 Wow - thank you so much I had this exact problem, note that your file location may not match exactly the three locations as shown at the bottom ESRI documentation. I am on 10.2.2 but the directory where my files really were was "Program Files (x86) / 10.2" lame difference that I did not catch. Does anyone know why these paths aren't fixed automatically when you d/l the python package from ESRI and re-install, or during a Repair from the ArcGIS for Desktop installer? My desktop10.2.pth file was actually empty after I re-installed Python and just did not get this part...anyway thanks again f –Michael Jan 8 '15 at 22:30 add a comment| up vote 1 down vote @PolyGeo's solution is top-notch, but not perf