Pythonengine Matlab cannot find attributes like 'find_matlab' - python

I am running python 2.7 and matlab2015a from a virtual environment. Both matlab and python are properly in the path (I can start them from terminal). But, whenever I do this:
python
from matlab.engine import pythonengine
pythonengine.find_matlab()
I get this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'find_matlab'
I get similar errors for all other functions in __init__.py in my /lib/python2.7/site-packages/matlab/engine.
I have installed the pythonengine using the instructions in https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html from my virtualenvironment.

This is because find_matlab() is a function of matlab.engine, not matlab.engine.pythonengine. Try:
python
import matlab.engine
matlab.engine.find_matlab()

Related

Pyp3 gives ModuleNotFoundError even if packaged is install

So I'm trying to figure out if I can speed up my code. For that purpose I installed pyp3. But when I try to run the python file using pyp3 I get error in the first line itself ModuleNotFoundError, But when I use simple python my code works smoothly. Is it due to python version difference ? I'm new to pyp3. Any suggestion/help would be appreciated. Thankyou
pypy3 main_feature_extraction.py
Traceback (most recent call last):
File "main_feature_extraction.py", line 1, in <module>
from dotenv import find_dotenv, load_dotenv
ModuleNotFoundError: No module named 'dotenv'

Import fails in terminal but works in PyCharm

I'm using PyCharm for a project with the following file hierarchy:
And I'm running main.py in PyCharm with the following configurations:
Working Directory: /Users/me/longpath/project/amlproject/pca_mixtures.
When I try to run in terminal, it fails:
~/longpath/project/amlproject/pca_mixtures$ python main.py
Traceback (most recent call last):
File "main.py", line 2, in <module>
from pca_mixtures.funcs import PCAMixture
ModuleNotFoundError: No module named 'pca_mixtures'
and nothing changes if I jump up to the parent folder:
~/longpath/project/amlproject$ python pca_mixtures/main.py
Traceback (most recent call last):
File "pca_mixtures/main.py", line 2, in <module>
from pca_mixtures.funcs import PCAMixture
ModuleNotFoundError: No module named 'pca_mixtures'
The reason for using from pca_mixtures.funcs import PCAMixture instead of just from funcs import PCAMixture was so that PyCharm would recognize the import and not red-underline it, as I've described here. Now, it seems that this has lead to me not being able to run the project in the terminal.
How would you handle this? I want to be able to run it in the terminal because the PyCharm output is not fully sequential (error messages output before program output) which is annoying when debugging.

Don't understand these ModuleNotFound errors

I am a beginner and learning Python. I have setup the environment with SublimeText and Python3.x
I am fine in creating code on Sublime and building it locally through Ctrl+B and for input() function I installed SublimeREPL and it works find up till now.
The issue I am facing is on Python interpreter. I am facing below error while import any package:
import tweepy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tweepy'
I cannot even run a Python script from there. My Python path is below:
C:\Users\waqas.FVC\AppData\Local\Programs\Python\Python37-32
Demo.py and hello.py are the two scripts I wrote initially which I am trying to execute from Python Terminal, but it is showing below errors:
test.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'test' is not defined
Demo.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'Demo' is not defined
The initial Python download includes a number of libraries, but there are many, many more that must be downloaded and installed separately. Tweepy is among those libraries.
You can find, and download, tweepy from here:
https://pypi.org/project/tweepy/

Python Path error - No Module Found error

I'm having issues running ortools on Linux. I downloaded it from google's site (https://developers.google.com/optimization/) and installed it using "make install," but when I go to use it in python I get the following:
Traceback (most recent call last):
File "regular.py", line 42, in <module>
from ortools.constraint_solver import pywrapcp
File "/home/m3/summer/ortools_examples/examples/python/ortools.py", line 2, in <module>
ImportError: No module named linear_solver
It looks like despite installing ortools, its still not in my python path correctly, so when I call it in the file, it doesn't find anything and returns an error, right? Any advice on how to solve this?

Python tensorflow error, sys has no attribute getdlflags

I Just attempted to install tensorflow for python and when I went to the console to see if the init.py was working it returned this error. I installed it manualy without pip or any other package manager.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\*username\AppData\Local\Programs\Python\Python35-32\lib\tensorflow\__init__.py", line 43, in <module>
_default_dlopen_flags = sys.getdlopenflags()
AttributeError: module 'sys' has no attribute 'getdlopenflags'
TensorFlow is not supported on Windows yet. Please follow this github issue which tracks TensorFlow Windows support.

Categories

Resources