Closed t2ac32 closed 2 years ago
So standard Python packages on Ubuntu shouldn't be used? What version of Anaconda did you use?
BTW I had just installed with the following steps and smop fails with smop/benchmark5/benchmark2.m
apt install python-pip
pip install smop
So standard Python packages on Ubuntu shouldn't be used? What version of Anaconda did you use?
BTW I had just installed with the following steps and smop fails with smop/benchmark5/benchmark2.m
apt install python-pip pip install smop
The thing is that 90% (invented/exagerated satistic) of the time people using python is using python3 now a days. SMOP only works with python2 (and subversions).
So NO PYTHON3 for installing.
using pip to install this package will use your default version of python, or the default version of python of the virtual environment being used.
NOW to your problem:
Could you run this in your terminal where you are running the "pip install smop" command:
python -V
and show us the result of the command.
mce@ubuntu18:~/Downloads/smop-master/smop/benchmark5$ python -V
Python 2.7.15+
Ubuntu 18 still defaults to Python2. To run Python you run python3
Below is the error I get with benchmark2.m.
mce@ubuntu18:~/Downloads/smop-master/smop/benchmark5$ smop -V
0.41
mce@ubuntu18:~/Downloads/smop-master/smop/benchmark5$ smop benchmark2.m
WARNING: Couldn't open 'parser.out'. [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/smop/parser.out'
WARNING: Token 'END_UNEXPECTED' defined, but not used
WARNING: Token 'CLASSDEF' defined, but not used
WARNING: There are 2 unused tokens
Generating LALR tables
WARNING: Couldn't create 'smop.parsetab'. [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/smop/parsetab.py'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/smop/main.py", line 61, in main
stmt_list = parse.parse(buf if buf[-1] == '\n' else buf + '\n')
File "/usr/local/lib/python2.7/dist-packages/smop/parse.py", line 850, in parse
buf, tracking=1, debug=options.debug_parser, lexer=new_lexer)
File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 331, in parse
return self.parseopt(input, lexer, debug, tracking, tokenfunc)
File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 909, in parseopt
tok = call_errorfunc(self.errorfunc, errtoken, self)
File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 192, in call_errorfunc
r = errorfunc(token)
File "/usr/local/lib/python2.7/dist-packages/smop/parse.py", line 838, in p_error
new_lexer)
File "/usr/local/lib/python2.7/dist-packages/smop/lexer.py", line 338, in raise_exception
my_lexer.lexdata[startpos:endpos]))
File "benchmark2.m", line 5
EMAIL : stefan@steinhaus
^
SyntaxError: Unexpected "@" (parser)
Errors: 1
Below is the error I get with benchmark2.m.
mce@ubuntu18:~/Downloads/smop-master/smop/benchmark5$ smop -V 0.41 mce@ubuntu18:~/Downloads/smop-master/smop/benchmark5$ smop benchmark2.m WARNING: Couldn't open 'parser.out'. [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/smop/parser.out' WARNING: Token 'END_UNEXPECTED' defined, but not used WARNING: Token 'CLASSDEF' defined, but not used WARNING: There are 2 unused tokens Generating LALR tables WARNING: Couldn't create 'smop.parsetab'. [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/smop/parsetab.py' Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/smop/main.py", line 61, in main stmt_list = parse.parse(buf if buf[-1] == '\n' else buf + '\n') File "/usr/local/lib/python2.7/dist-packages/smop/parse.py", line 850, in parse buf, tracking=1, debug=options.debug_parser, lexer=new_lexer) File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 331, in parse return self.parseopt(input, lexer, debug, tracking, tokenfunc) File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 909, in parseopt tok = call_errorfunc(self.errorfunc, errtoken, self) File "/usr/local/lib/python2.7/dist-packages/ply/yacc.py", line 192, in call_errorfunc r = errorfunc(token) File "/usr/local/lib/python2.7/dist-packages/smop/parse.py", line 838, in p_error new_lexer) File "/usr/local/lib/python2.7/dist-packages/smop/lexer.py", line 338, in raise_exception my_lexer.lexdata[startpos:endpos])) File "benchmark2.m", line 5 EMAIL : stefan@steinhaus ^ SyntaxError: Unexpected "@" (parser) Errors: 1
This is not an installation related problem your installation is correct.
Your problem seems to be that you have characters in you .m file that can't be parsed by SMOP.
To be more specific line 5 in you .m file has an @ sign.
Either put that in a comment or try removing it for the conversion if it is not matlab code.
Thanks for the responses.
I'm going to go play with some real matlab code and see how things go.
Steve
%***************************************************************************
%* Matlab Benchmark program version 5.0 *
%* Author : Stefan Steinhaus *
%*
EMAIL : stefan@steinhaus
-
net.de *
%* This program is public domain. Feel free to copy it freely. *
%***************************************************************************
I successfully installed it through pip, but then I always get a "not found" when I type smop in the terminal. Do I really need to install Anaconda on Kubuntu just to make it work?!
I successfully installed it through pip, but then I always get a "not found" when I type smop in the terminal. Do I really need to install Anaconda on Kubuntu just to make it work?!
You don't need anaconda to make it work.
Also I haven't test in kubuntu just ubuntu.
Can you paste here your console log? This sounds like you installed but when running you are you using the wrong environment.
Thanks for your reply. If I write smop in the shell, it is just an unknown command. Same if I call smop from Python3 or from Python2 (does it make any sense?). If I go with the shell to the smop directory and type "python2 main.py myfile.m -o myfile.py" I get an error message related to the relative imports. I tried to change every "from . import..." to "import" (because the files are there), and now I get no error. Nevertheless, still no output file is generated...
Il giorno lun 4 nov 2019 alle ore 02:41 Tracer notifications@github.com ha scritto:
I successfully installed it through pip, but then I always get a "not found" when I type smop in the terminal. Do I really need to install Anaconda on Kubuntu just to make it work?!
You don't need anaconda to make it work.
Also I haven't test in kubuntu just ubuntu.
Can you paste here your console log? This sounds like you installed but when running you are you using the wrong environment.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/victorlei/smop/issues/149?email_source=notifications&email_token=AAMRNO6GS73VYW5K3TPR4BTQR54TPA5CNFSM4I5X743KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC6CWKQ#issuecomment-549202730, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMRNO5KRH3RDEMXUWJ5K7TQR54TPANCNFSM4I5X743A .
I have created a virtual environment in conda but when i tried to check if smop is installed correctly I got this error--"module not found" . How can I fix it .Any suggestions. @t2ac32
(testsmopenv) C:\Users\Admin>smop -V
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\Scripts\smop-script.py", line 33, in
@abedin17 mmm. it's been a long time since I wrote this so many probably changed. For what I see you are trying to install in windows. This thread is for installing in Ubuntu (Linux).
Hi, thanks for replying. Well can you make one for windows that would be really helpful
OK so I spent more time that I would like to admit trying to make smop run. These are some steps for a super easy installation in UBUNTU 18.04 using Anaconda.
Notes/Requirements: Anaconda (with anaconda navigator)
1: Open terminal:
option 1: CTRL +Alt +T option 2: app menu, search for terminal
2: Check which environment you are using.
(First word between parenthesis in your terminal lead text base in attached image)![image](https://user-images.githubusercontent.com/3275434/66256099-c8b02180-e78a-11e9-93dd-a1b2217671ee.png)
3: Open ANACONDA
If you are using "base" environment check if you have anaconda installed (attached image)![image](https://user-images.githubusercontent.com/3275434/66256122-0e6cea00-e78b-11e9-8658-3f076f918f17.png)
4 Create new python2 environment
create a new environment for smop
option 1: Graphical method
anaconda-navigator
This should open anaconda navigator Graphical user interface.option 2: Bash method:
To be safe lets update conda, type in terminal:
conda update conda
Replace this:conda create -n yourenvname python=x.x anaconda
For this and write it in terminal and press enter:conda create -n smop python=2.7 anaconda
5 Activate newly created environment:
In terminal type:![image](https://user-images.githubusercontent.com/3275434/66256456-40338000-e78e-11e9-8b1e-e5acbb73126e.png)
conda activate smop
The text in parenthesis at the beggining of terminal should change to (smop) user@computername6 Install smop
In TERMINAL type:
pip install smop
You should see something like this at the end of the command and before the new line in terminal.Successfully built smop networkx Installing collected packages: ply, numpy, scipy, decorator, networkx, smop Successfully installed decorator-4.4.0 networkx-2.2 numpy-1.16.5 ply-3.11 scipy-1.2.2 smop-0.41
FINALLY: Test version of smop
In terminal type:
smop -V
If this gives you a version you successfully installed smop, we are almost there!CONVERT A FILE FROM matlab .m to PYTHON .p
Type in terminal :
smop myMatlab.m
NOTE:
For this last command to work you should run the command in the folder where your .m file is located. In terminal go to the folder where the file you want to convert is saved (change directory command is your friend)
cd path/to/my/file.m
OR
Type smob in terminal (with your smob environment active) and drag and drop the file to convert from its location in to the terminal line where you are writing.
The Result .py file will appear in the same folder where the .m was dragged from.
Remember Every time you want to use smob you have to activate the environment where smob is installed. Just open the terminal check the first word between parenthesis if this word is not smob (or name given to the env in step 2) write in terminal
conda activate smob
Hope this helps !