Running on a windows machine python 2.7, whenever I try to run my script using the command line I receive the following error.
import winrandom
ImportError: DLL load failed: The specified module could not be found.
But this error does not happen when I run my script through a python IDE
Make sure your PATH correctly includes your python2.7 and python2.7\Scripts directories.
Snippet on settings environment variables (if needed):
http://msdn.microsoft.com/en-us/library/ms682653%28v=vs.85%29.aspx
Related
I followed the instructions and successfully installed pypostal python package (package to help parse addresses) https://github.com/openvenues/pypostal.
I'm trying to set this up so the python script can be callable through an apache server on an ubuntu box. It works fine when executing the script from Terminal. However, it doesn't work when I make a call to apache to execute the script and I get the following error in the apache logs. I believe it might be some pathing issue but I haven't had much luck to resolve it. Any ideas will be appreciated.
Error:
File "/var/www/html/cgi-bin/get_parsedAddress.py", line 5, in
from postal.parser import parse_address
ModuleNotFoundError: No module named 'postal'
python script contents:
import sys
from postal.parser import parse_address
addressList = parse_address(sys.argv[1])
print(addressList)
Structure of my working directory:

The import command in the train.py file:
from src.pl_data_modules import ConsecDataModule
It works when I type them in the python command line interface but leads to a ModuleNotFoundError when I directly run train.py.
I know that this is relevant to the python import mechanism but how to solve this issue?
Yesterday, I accidentally deleted the Path variable but I think I restored them. I added Python path to it and I've got my python running through command prompt and also pip is working. However, I'm unable to import new modules to Python shell.
It comes up with the following error
enter code here
File "<pyshell#1>", line 1, in <module>
import wxPython
ModuleNotFoundError: No module named 'wxPython'
Any suggestions as to what I'm missing? Maybe I didn't add the Path correctly?
here is what I have added
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Common Files\Oracle\Java\javapath;
C:\Users\user1\AppData\Local\Programs\Python\Python36-32\Scripts;
C:\Users\user1\AppData\Local\Programs\Python\Python36-32;
C:\Users\user1\AppData\Local\Programs\Python
Also add C:\Users\<your user>\AppData\Local\Programs\Python\Python36-32\Libs; to your path
I have installed plyfile in the Scripts subdirectory of the Anaconda3 (I run Windows 10), using the pip3. When I enter the command
import plyfile
in the Python 3.5 Shell, the command is executed without problems.
But when I move to Spyder and I enter the same command in the console I receive an error message:
import plyfile
Traceback (most recent call last):
File "<ipython-input-3-db7ef797d821>", line 1, in <module>
import plyfile
ImportError: No module named 'plyfile'
I tried to add the path of the file to the environment using the Windows Commander and giving at the C:\ the command:
sys.path.append(C:\Users\Alexandros_7\Downloads\plyfile-0.4)
but I received the error message:
"sys.path.append" is not recognized as an internal or external command, operable program or batch file
I also tried the following commands from the console of Spyder:
import sys
sys.path.append("C:\\Users\\Alexandros\\Downloads\\plyfile")
These commands were executed without a problem. Then I entered, import plyfile and I received the same error message -- i.e. that "No module named "plyfile"".
Could you please help me?
try give Spyder the same environment paths like Anaconda, in your case the path to the installed plyfile eg.:
your_module is located in: "C:\Users\Alexandros\your_module.py"
in Spyder:
lets add the located path to the system environment
import sys
sys.path.append("C:\Users\Alexandros\") #need string
lets import your module
import your_module
reload(your_module)
I am trying to set up IBPY and Python on my Mac to run with Interactive Brokers. I have installed Git. I created a subdirectory ibapi under Home. I downloaded IBPy using git clone https://github.com/blampe/IbPy from the ibapi directory.
I am now trying to run the Demo.py program in Spyder. When I choose Run, I receive the error message:
ImportError: No module named Ib.Message
The first few lines of the demo program are:
import os
import sys
import time
import Ib.Message
import Ib.Socket
import Ib.Type
I am also trying to run a sample program: ib_api_demo from http://www.quantstart.com/articles/Using-Python-IBPy-and-the-Interactive-Brokers-API-to-Automate-Trades. When I try to run this, I get the error message:
ImportError: No module named ib.ext.Contract
The first few lines are:
from ib.ext.Contract import Contract
from ib.ext.Order import Order
from ib.opt import Connection, message
I figured this out. The problem was I was launching Spyder from my Mac Finder. When I did this, I received the error messages. When I launched Spyder (actually Anaconda Python) by typing "Spyder" in the Terminal window, this launched Anaconda Python. From here, I could run all my programs successfully with no errors.