I am using ZeroBrane Studio as IDE to code deep learning. I have realized that the models I save when programming in the IDE (using Lua 5.1 as interpreter) do not load well when executing the same loading from Torch7. The same happens when learning from torch (./th code.lua) and then trying to load them inside the IDE. I get something like:
/opt/zbstudio/bin/linux/x64/lua: /home/dg/torch/install/share/lua/5.1/torch/File.lua:294: unknown object
Does anybody know how to check the lua version that torch is using? Any idea on how to workaround this?
Thanks!
update: It seems that I am indeed using the same Lua version (5.1) in both Torch and ZeroBrane. I still get different behaviour (one successful and the other crashing) when passing through torch.load().
To check the version of Lua that anything is running, you would usually print _VERSION. It's a global variable that stores the version of Lua (unless you overwrite it, of course).
print(_VERSION)
If this isn't available for some reason, they might state their version on their site (?)
Most command line tools on Linux understand the -v command line switch (for "version"). So do Lua and LuaJIT.
To figure out which interpreter is running a particular script, you can scan the arg table for the smallest (usually negative) index:
local exe, i = arg[ 0 ], -1
while arg[ i ] do
exe, i = arg[ i ], i-1
end
print( exe )
Or (on Linux) you can look into the /proc file system while your script is running:
ls -l /proc/4425/exe
(substitute 4425 with real process ID).
Judging from the error message the interpreter used in ZeroBrane Studio seems to be /opt/zbstudio/bin/linux/x64/lua in your case.
#siffiejoe: thanks for posing your question regarding versions, it gave me the correct directions to explore.
/opt/zbstudio/bin/linux/x64/lua version is LuaJIT 2.0.2
"lua" command alone points to /usr/bin/lua, and it is Lua 5.1.5
~/torch/install/share/lua/5.1 seemed to contain Lua 5.1
~/torch/install/bin/luajit is 2.1.0-alpha
So after realizing that terminal "th" is using LuaJit 2.1.0 all I had to do is create a user.lua in ZeroBrane and add the line "path.lua = "~/torch/install/bin/luajit". Now ZB is using the same luajit interpreter as th.
Thanks all for your suggestions.
Related
When writing luarocks install gumbo
In the location/directory of my luarocks file in cmd, I am getting the following error
Warning: Could not find Lua 5.3 in PATH.
Modules may not install with the correct configurations. You may want to specify the path prefix to your build of Lua 5.3 using --lua-dir
Installing https://luarocks.org/gumbo-0.5-1.src.rock
Error: Failed finding Lua library. You may need to configure LUA_LIBDIR.
I've added lua53.exe to the same directory, and added the file both to my user variables and system variables in control panel.
Not sure if worth mentioning, but when running lua53.exe and trying to use luarocks install gumbo from there,
the lua53 cmd-like window responds with stdin:1: syntax error near 'install'
I was hoping to do some web scraping with lua, and later on building a World of Warcraft addon that utilizes gumbo to show certain helpful information within the WoW client, but I can't seem to even get the most basic stuff to work...
Setting up LuaRocks on Windows is annoying and I'm not familiar with it myself. If you added both the LuaRocks and Lua 5.3 Windows binaries (Executables and Includes) to your Path system variable:
luarocks path prints the commands for setting up the LUA_PATH and LUA_CPATH system variables.
The config.lua file tells you what your variables.LUA_LIBDIR value is. You can check it with luarocks config. For me that file would be in:
C:/Users/Ketho/AppData/Roaming/luarocks/config-5.3.lua
otherwise you can create an empty file there and put in this line to point it to wherever your Lua folder is:
variables.LUA_LIBDIR = "C:/lua-5.3.5_Win32_bin"
variables.LUA_INCDIR = "C:/lua-5.3.5_Win32_bin/include"
As for using gumbo to show information within WoW, the addon environment is sandboxed. Unless you meant you just want to get the data to hardcode into your addon.
I have a lua script test.lua
which when executed lua test.lua it executes and provides me output as expected and it uses lua 5.3 when compiling
But when i execute the same test.lua via wrk (http performance test benchmark brew tool) , it reached to lua 5.1 (which I dont have in my system) rather than 5.3
And there is no any wrk config which tries to reach to lua 5.1 . I am not sure why it behaves different and hits different version of lua
An hint to this confusion will be appreciated.
From the LuaJIT site, here:
LuaJIT is API-compatible with Lua 5.1
wrk uses LuaJIT, as noted here.
I'm new to lua and recently learning DL with Torch.
I have installed torch just following instructions: http://torch.ch/docs/getting-started.html#_ and added some packages using luarocks install. Then I wrote a test file:
require 'torch'
require 'nn'
--[[do something]]
when running with lua test.lua (Ubuntu 14.04), it errs as followed:
error loading module 'libpaths' from file
'/home/user1/torch/install/lib/lua/5.1/libpaths.so':
/home/user1/torch/install/lib/lua/5.1/libpaths.so: undefined symbol:
luaL_register
It seems something wrong with path settings or so. However, when I run test with command th, it works fine.
I searched and examined these answers: Error loading module (Lua)
Torch7 Lua, error loading module 'libpaths' (Linux)
not fully answered my question though.
So I wonder where exactly the error comes from, and how to fix it. Even though I can use torch with th.
ADD:
I find that the reason maybe API luaL_register is not supported in ver 5.2 which is what I am using, while th calls a lua shell in ver 5.1? So does this mean I can only use th to run my files?
You are likely using your system Lua (probably version 5.2), but Torch requires LuaJIT it comes with. Run your script as luajit test.lua (it's probably in /home/user1/torch/install/bin/luajit).
I am a newb with python and just learning what to do.
I am using pyscripter and have been for a while whilst learning.
I am now going through an online course which is taught in 2.6, yet my pyscripter uses the latest.
I need to know how to change it to use an older version, I have seen replies about changing the PATH variable but not where it is or how to do it.
I have 3 versions of python on my machine, 25,26 and 33.
I don't know if this is the best way to do it, but those are the two ways I did it:
WAY 1 (The best of two)
Go to PyScripter>>Tools>>Options...>>Custom Parameters... and add the following values
1. PythonDir = C:\Program Files\CustomPythonInstallation
2. PythonExe = C:\Program Files\CustomPythonInstallation\python.exe
3. PythonVer = 3.3.3
Note: Adapt the Name = Value pairs above to your case.
And close the window with OK button.
Now select PyScripter>>Run>>Python Engine>>Remote and your are ready to go.
WAY 2 (The more temporary solution)
Go to PyScripter>>Run>>Configure External Run...
set the "Application:" field to your python.exe file
Close the window with OK button.
Make sure you run your scripts with PyScripter>>Run>>External Run (Alt+F9)
I hope this helped, good luck.
The easiest way I know (on Windows) is, having used the installer executable, I select from the Start menu's PyScripter folder whichever version of Python I want to run.
You can modify the PYTHONPATH (under Pyscripter>>Tools, for instance)
You can modify your External Python Interpreter with Pyscripter>>Modify Tools>>Python &Interpreter>>Modify
You can modify the default Python engine used with Pyscripter>>Options>>IDE Options>>Python Interpreter>>Python Engine Type
You can simply redirect Pyscripter to see the environment of a different Python distribution.
In Windows, do this by assigning PYTHONDLLPATH in the Pyscripter shortcut. You can r-click on the shortcut, access its properties and then set the target to:
[Pyscripter executable dir] --PYTHONDLLPATH [Python distribution dir]
See this image to help you out:
setting a shortcut target
For example, in my Win10 64-bit computer I have a Python 2.7.8 installation back from when I installed ArcGIS, which is automatically recognized by my 32-bit Pyscripter installation.
In the same computer, I also have Anaconda installed with two environments that feature two 64-bit Python distributions:
2.7.14 in "C:\ProgramData\Anaconda2"
3.6 in "C:\Users\bouzi\AppData\Local\conda\conda\envs\py3"
When I installed a 64-bit version of Pyscripter, that Pyscripter version couldn't even open, as it couldn't find the conda distributions. I had to point them to it by replacing the shortcut target to:
"C:\Program Files\PyScripterx64\PyScripter.exe" --PYTHONDLLPATH "C:\ProgramData\Anaconda2"
You can create three Pyscripter shortcuts that point to these different installations of Python within your system. It's probably not the optimal way to deal with this but it works, and allows you to combine Anaconda environments with Pyscripter.
You can also read more on opening non-standard python distributions with PyScripter from this link.
Run->Python Versions -> setup Python Versions -> Add... select folder
p.s.
python 3.7.3 - ok,
still python 3.10.5 could not be identified by PyScripter in such a way (actually works with WAY_1 Solution in this thread but pip install under such env. not succeed afterwards)
In Delphi 2009, how can I build a project using command line. I tried using the command line compiler and supplying -a -u -i -r in dcc32.cfg file. But compiler is not recognizing the paths and throwing the error required package xyzPack is not found.
-aWinTypes=Windows;WinProcs=Windows;DbiProcs=BDE;DbiTypes=BDE;DbiErrs=BDE
-u"C:\MyProj\Output\DCP"
-i"C:\MyProj\Output\DCP"
-r"C:\MyProj\Output\DCP"
and on command line i execute the command :
dcc32 "C:\MyProj\MyProject.dpr" -B -E"c:\MyProj\Output\EXE"
What am I doing wrong here?
Thanks & Regards,
Pavan.
Instead of invoking the compiler directly, consider using MSBuild on your .dproj, since that's what the IDE uses. Delphi MSBuild Build Configurations From Command Line might help you with that.
From the related answer (as shown below) ie:
Compiling with Delphi 2009 from a command line under Windows Vista 64-bit
I notice that you should be able to build a single package from the command line this way. I have used batch files (buildall.cmd) to launch dcc32, and have not yet used msbuild.
I have ultimately found both approaches frustrating, and have instead decided to opt for building a little GUI shell (a lite version of Final Builder, if you like) that basically works as a semi-graphical semi-command-line way of automating my builds and filtering the compiler output to produce results. I would be highly interested in anyone else's experiences with "tinder box" (daily or even continuous build) operations with Delphi.
You may end up where I'm heading... just buy Final Builder. :-)