victorlei / smop

Small Matlab to Python compiler
MIT License
1.08k stars 409 forks source link

Installing smop #124

Open andreeaf13 opened 6 years ago

andreeaf13 commented 6 years ago

Hi, I'm new to Python, Github and i have some questions regarding the installation. Can I install this tool on windows 10? And how to proceed? I tried anything, but unfortunately not worked.

victorlei commented 6 years ago

Try to install anaconda first. Once done, install smop with pip

If you cut/paste error messages it will make possible to say something more specific

RobBW commented 6 years ago

I’m having problems which appear to be related to the versioning process too. Here are my notes:

Smop version problem

I attach a terminal output script for my attempt at installing smop v0.40. in an Anaconda environment on OsX High Sierra latest version 10.13.5

As you can see setup.py runs into trouble in determining the correct version number.

I executed the first few lines of the setup file step-by-step and found that the problem starts in the try line:

try: VERSION = os.popen("git describe --tags").read().strip()

My terminal output follows: Python 3.6.5 | packaged by conda-forge | (default, Apr 6 2018, 13:44:09) [GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import os from setuptools import setup VERSION = os.popen("git describe --tags").read().strip() print(VERSION) 0.32-36-g844034e

I have no idea where this version number comes from but it immediately overwrites the value in your version.py file and causes the warning messages that follow.

I forced the situation by writing the version number directly into the setup.py file and compilation was successful except for the 2 Syntax errors from the test programs.

try:

VERSION = os.popen("git describe --tags").read().strip()

__VERSION__ = "0.40"

However running the octave test produced the following: (Py36-X) bash-3.2$ cd /Users/robw/OCTest (Py36-X) bash-3.2$ ls -a . .. octave-4.0.2.tar.gz octave-workspace

(Py36-X) bash-3.2$ smop -a octave-4.0.2.tar.gz -g '/scripts/.m’

WARNING: Couldn't open 'parser.out'. [Errno 20] Not a directory: '/Users/robw/.local/lib/python3.6/site-packages/smop-0.40-py3.6.egg/smop/parser.out' WARNING: Token 'CLASSDEF' defined, but not used WARNING: Token 'END_UNEXPECTED' defined, but not used WARNING: There are 2 unused tokens Generating LALR tables WARNING: Couldn't create 'parsetab'. [Errno 20] Not a directory: '/Users/robw/.local/lib/python3.6/site-packages/smop-0.40-py3.6.egg/smop/parsetab.py'

Do these messages mean I should have the octave tar file in the same folder as smop?

Hope you can help.

Regards Rob

RobBWilkinson@gmail.com

On 5/06/2018, at 10:38, victorlei notifications@github.com wrote:

Try to install anaconda first. Once done, install smop with pip

If you cut/paste error messages it will make possible to say something more specific

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/victorlei/smop/issues/124#issuecomment-394522872, or mute the thread https://github.com/notifications/unsubscribe-auth/AGLYJsGCtfUAYgPrMbe8WBmQC5Ergg6vks5t5bb2gaJpZM4UT6tS.

victorlei commented 6 years ago

Rob

Regarding versioning problem: my guess is that you have an old version of smop installed ssomewheere in your path. Try

find / -name smop -print 2> /dev/null

Get rid of old versions and reinstall with pip

Regarding the other bugs take a look at http://chiselapp.com/user/victorlei/repository/smop-dev/rptview?rn=1

As you see there are lots of probleems there Victor

victorlei commented 6 years ago

Rob,

I really appreciate your effort to debug the versioning scheme. Here is how it works today --- it's entirely possible I overlooked something.

The versioning is managed in two files: setup.py and smop/version.py. Every time you run setup.py it goes to git and asks for the latest annotated version. Presumably, you have git installation working. Once git reports with something like "0.40-deadbeef" , setup.py overwrites version.py with the reported version. All this happens during the installation phase, every timie setup.py is run.

When smop is used, it imports version.py and loads version variable from version.py. That's the whole story. Do I miss something? The scheme is not foolproof. For example, having several smop installations living side by side on the same system is a proven road to hell.

Victor

hidetokoizumi commented 6 years ago

At #123 , you kindly suggested to install smop with pip, and check the version by 'smop --version', but I got the following output:

Hidetos-MacBook-Air:~ hidetokoizumi$ pip install smop Collecting smop Requirement already satisfied: numpy in ./anaconda3/lib/python3.6/site-packages (from smop) (1.14.0) Requirement already satisfied: scipy in ./anaconda3/lib/python3.6/site-packages (from smop) (1.0.0) Requirement already satisfied: networkx in ./anaconda3/lib/python3.6/site-packages (from smop) (2.1) Requirement already satisfied: ply in ./anaconda3/lib/python3.6/site-packages (from smop) (3.10) Requirement already satisfied: decorator>=4.1.0 in ./anaconda3/lib/python3.6/site-packages (from networkx->smop) (4.2.1) Installing collected packages: smop Successfully installed smop-0.0.0

Hidetos-MacBook-Air:~ hidetokoizumi$ smop --version Traceback (most recent call last): File "/Users/hidetokoizumi/anaconda3/bin/smop", line 7, in from smop.main import main File "/Users/hidetokoizumi/anaconda3/lib/python3.6/site-packages/smop/init.py", line 4, in import version ModuleNotFoundError: No module named 'version'