I'm new to luarocks and I just tried to install luarepl.
The installation apparently went fine:
$ luarocks install luarepl
Installing https://luarocks.org/luarepl-0.8-1.rockspec...
Using https://luarocks.org/luarepl-0.8-1.rockspec... switching to 'build' mode
Updating manifest for /Users/me/.luarocks/lib/luarocks/rocks-5.1
luarepl 0.8-1 is now built and installed in /Users/me/.luarocks (license: MIT/X11)
but if I try to launch the executable, it seems that the installation is broken:
$ ~/.luarocks/bin/rep.lua
/usr/local/bin/lua5.1: ...cks/lib/luarocks/rocks-5.1/luarepl/0.8-1/bin/rep.lua:23: module 'repl.console' not found:
no field package.preload['repl.console']
no file './repl/console.lua'
no file '/usr/local/share/lua/5.1/repl/console.lua'
no file '/usr/local/share/lua/5.1/repl/console/init.lua'
no file '/usr/local/lib/lua/5.1/repl/console.lua'
no file '/usr/local/lib/lua/5.1/repl/console/init.lua'
no file './repl/console.so'
no file '/usr/local/lib/lua/5.1/repl/console.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file './repl.so'
no file '/usr/local/lib/lua/5.1/repl.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
...cks/lib/luarocks/rocks-5.1/luarepl/0.8-1/bin/rep.lua:23: in main chunk
[C]: ?
I look into the ~/.luarocks dir:
$ cd ~ ; find .luarocks
.luarocks
.luarocks/bin
.luarocks/bin/rep.lua
.luarocks/config.lua
.luarocks/lib
.luarocks/lib/luarocks
.luarocks/lib/luarocks/rocks-5.1
.luarocks/lib/luarocks/rocks-5.1/luarepl
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/bin
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/bin/rep.lua
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/doc
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/doc/COPYING
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/doc/IDEAS.md
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/doc/plugins.md
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/doc/README.md
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/doc/Roadmap.md
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/luarepl-0.8-1.rockspec
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/rock_manifest
.luarocks/lib/luarocks/rocks-5.1/manifest
.luarocks/share
.luarocks/share/lua
.luarocks/share/lua/5.1
.luarocks/share/lua/5.1/repl
.luarocks/share/lua/5.1/repl/console.lua
.luarocks/share/lua/5.1/repl/init.lua
.luarocks/share/lua/5.1/repl/plugins
.luarocks/share/lua/5.1/repl/plugins/autoreturn.lua
.luarocks/share/lua/5.1/repl/plugins/completion.lua
.luarocks/share/lua/5.1/repl/plugins/example.lua
.luarocks/share/lua/5.1/repl/plugins/filename_completion.lua
.luarocks/share/lua/5.1/repl/plugins/history.lua
.luarocks/share/lua/5.1/repl/plugins/keep_last_eval.lua
.luarocks/share/lua/5.1/repl/plugins/linenoise.lua
.luarocks/share/lua/5.1/repl/plugins/pretty_print.lua
.luarocks/share/lua/5.1/repl/plugins/rcfile.lua
.luarocks/share/lua/5.1/repl/plugins/rlwrap.lua
.luarocks/share/lua/5.1/repl/plugins/semicolon_suppress_output.lua
.luarocks/share/lua/5.1/repl/sync.lua
.luarocks/share/lua/5.1/repl/utils.lua
and I can find that stuff.
I tried adding a line to config.lua to load packages from local installation to no avail:
$ cat ~/.luarocks/config.lua
local_by_default=true
(removing it has no effect)
did I miss some obvious step?
running luarocks with no arguments gives me:
CONFIGURATION
Lua version: 5.1
Configuration files:
System: /usr/local/etc/luarocks51/config-5.1.lua (ok)
User : /Users/me/.luarocks/config.lua (ok)
Rocks trees in use:
/Users/me/.luarocks ("user")
/usr/local ("system")
it seems that the user rock tree is not in the package path:
$ lua
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> print(package.path)
./?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/lib/lua/5.1/?.lua;/usr/local/lib/lua/5.1/?/init.lua
why?
From https://github.com/luarocks/luarocks/wiki/Using-LuaRocks:
Most LuaRocks installations will feature two rocks trees:
"system" rock tree (used by default)
"user" rock tree
To be able to use the module, we need to make sure that Lua can find that dkjson.lua file when we run require("dkjson"). You can check your Lua paths from the Lua environment, using
print(package.path)
print(package.cpath)
These variables can be pre-configured from outside Lua, using the LUA_PATH and LUA_CPATH environment variables.
If you installed both Lua and LuaRocks in their default directories (/usr/local on Linux and Mac OSX), then the "system" tree is /usr/local and it will work by default. However, the "user" tree (for installing rocks without admin privileges) is not detected by Lua by default. For that we'll need to configure these environment variables.
LuaRocks offers a semi-automated way to do this. If you type the following command:
luarocks path --bin
it will print commands suitable for your platform for setting up your environment. On typical Unix terminal environments, you can type this:
eval $(luarocks path --bin)
and it apply the changes, temporarily, to your shell. To have these variables set permanently, you have to configure the environment variables to your shell configuration (for example, by adding the above line to your .bashrc file if your shell is Bash).
Related
Run the following simple lua script but got error. I am running lua 5.2 on ubuntu.
local host, port = "127.0.0.1", 80
local socket = require("socket")
local tcp = assert(socket.tcp())
tcp:connect(host, port);
--note the newline below
tcp:send("GET / HTTP/1.1\r\n\r\n");
Here is the error:
~/learn/lua$ lua te.lua
lua: te.lua:2: module 'socket' not found:
no field package.preload['socket']
no file '/usr/local/share/lua/5.2/socket.lua'
no file '/usr/local/share/lua/5.2/socket/init.lua'
no file '/usr/local/lib/lua/5.2/socket.lua'
no file '/usr/local/lib/lua/5.2/socket/init.lua'
no file '/usr/share/lua/5.2/socket.lua'
no file '/usr/share/lua/5.2/socket/init.lua'
no file './socket.lua'
no file '/usr/local/lib/lua/5.2/socket.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.2/socket.so'
no file '/usr/lib/lua/5.2/socket.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './socket.so'
stack traceback:
[C]: in function 'require'
te.lua:2: in main chunk
[C]: in ?
Problem solved after installing the package manager luarocks and then socket package.
Here are the commands from the page
$ wget https://luarocks.org/releases/luarocks-2.4.1.tar.gz
$ tar zxpf luarocks-2.4.1.tar.gz
$ cd luarocks-2.4.1
$ ./configure; sudo make bootstrap
$ sudo luarocks install luasocket
$ lua
Lua 5.3.3 Copyright (C) 1994-2016 Lua.org, PUC-Rio
> require "socket"
I have installed lua image according to this - link. I also tested my install with luajit -limage -e "image.test()" and it says 0 errors and 0 warnings. Also, when I try
> require 'image'
> l = image.lena()
There are no errors. However, when I try image.display(l), I get the following errors:
/home/srilatha/torch/install/share/lua/5.1/trepl/init.lua:384: module 'qt' not found:No LuaRocks module found for qt
no field package.preload['qt']
no file '/home/srilatha/.luarocks/share/lua/5.1/qt.lua'
no file '/home/srilatha/.luarocks/share/lua/5.1/qt/init.lua'
no file '/home/srilatha/torch/install/share/lua/5.1/qt.lua'
no file '/home/srilatha/torch/install/share/lua/5.1/qt/init.lua'
no file './qt.lua'
no file '/home/srilatha/torch/install/share/luajit-2.1.0-beta1/qt.lua'
no file '/usr/local/share/lua/5.1/qt.lua'
no file '/usr/local/share/lua/5.1/qt/init.lua'
no file '/home/srilatha/.luarocks/lib/lua/5.1/qt.so'
no file '/home/srilatha/torch/install/lib/lua/5.1/qt.so'
no file '/home/srilatha/torch/install/lib/qt.so'
no file './qt.so'
no file '/usr/local/lib/lua/5.1/qt.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'error'
/home/srilatha/torch/install/share/lua/5.1/trepl/init.lua:384: in function 'require'
/home/srilatha/torch/install/share/lua/5.1/image/init.lua:1363: in function 'display'
[string "_RESULT={image.display(l)}"]:1: in main chunk
[C]: in function 'xpcall'
/home/srilatha/torch/install/share/lua/5.1/trepl/init.lua:651: in function 'repl'
...atha/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk
[C]: at 0x00406670
I have torch running properly so I don't know what the problem would be with qt. How can I fix this?
Did you read this by any chance?
https://github.com/torch/image/blob/master/doc/gui.md
image.display among other functions can only be accessed via the qlua Lua interpreter.
Calling that function from LuaJit will result in the errors you're facing.
Just to add to Piglet's answer - read about qlua:
https://github.com/torch/qtlua/blob/master/doc/qt.md#qlua
At first I thought: "Oh dear, I'm using luajit, in a torch installation, I have no time and motivation to install another interpreter, configure luarocks to work with it, and then install everything from scratch". Good news: I was wrong.
qlua is an interpreter, but it gets installed in your existing Lua + Torch directory.
$ luarocks install qtlua
$ luarocks install qttorch
$ which qlua
/home/me/torch/install/bin/qlua
$ qlua
Lua 5.1 Copyright (...)
> require('image')
> l = image.lena()
> image.display(l)
>
.. a window pops up, and the prompt returns immediately.
This is because qlua has a background GUI thread to display your images and react to events (closing, and resizing the window, upon which the image will be scaled - with no aspect preservation: W & H independent).
I'm using CMake 3.4.1, on Windows 10, with MSYS2 (everything up-to-date as of Dec. 25 2015).
When I use CMake's find_file command, it won't work unless the path is in Windows-style. This is a problem for me, because I'm trying to use findwxWidgets.cmake, which fails because of this.
For example:
CMakeLists.txt:
cmake_minimum_required(VERSION 3.0)
find_file(version_h version.h PATHS /mingw64/include/wx-3.0/wx)
message(STATUS "version_h: ${version_h}")
Running cmake spits out:
-- version_h: version_h-NOTFOUND
But it's clearly in there:
>>> file /mingw64/include/wx-3.0/wx/version.h
/mingw64/include/wx-3.0/wx/version.h: C source, ASCII text
I'm wondering if this is a bug, or if there's some obscure flag I have to set to get this to work. How do I get CMake's find_file to find files with UNIX-style paths?
MinGW-w64 cmake can't understand MSYS2 paths. You might propose a path transformation test program to the CMake developers, but that's fairly gross and I'd hope the would reject that. Instead these things must be solved case-by-case. wx-config, being a shell script, is providing an MSYS2 path.
This is a bug in the currently release MSYS2 wxWidgets packages that will be fixed in the next release. To work around it, find the line in /mingw64/bin/wx-config or /mingw32/bin/wx-config:
prefix=${input_option_prefix-${this_prefix:-/mingw64}}
(or /mingw32 of course) and add after it:
if [ "x${MSYSTEM}" = "xMINGW32" ] || [ "x${MSYSTEM}" = "xMINGW64" ]; then
prefix=$(cygpath -m ${prefix})
fi
Be careful to remove it at upgrade time though.
I downloaded and installed win32 yaws-1.98 installer for my win7 and tried to start it from windows command prompt with: yaws -i. the result I got is just as right below. where I have placed # was a simicolon.
Failed to create the process entirely.
Tried to invoke: erl.exe -pa "C:/Program Files/Yaws-1.98/ebin" -conf "C:\Program Files\Yaws-1.98\yaws.conf" -run yaws -yaws id default #
Make sure you have erl in your environment PATH
after some research, I placed the following paths in the O.S environment variables list separated by semicolon, first under the name ERL_LIBS and then PATH all with no change :
C:\Program Files\erl5.10.3\erts-5.10.3\bin
C:\Program Files\erl5.10.3\bin
what could I be missing
...s.b help.
I am attempting to rebuild my development/test environment on a new laptop running windows7 32 bit. imageMagick is one of the modules I had installed in an (ancient) version on my old laptop. I have downloaded and installed perl from dwimperl, which is v5.14.2 and had a couple modules install, and several did not.
cpanm Image::Magick - failed
cpanm DB_File - failed
cpanm Time::HiRes - failed
I searched around and found a discussion on magick failing to install on v5.12, but couldn't tell if that was supposed to have been fixed, or if I need to attempt to recreate the fix discussed for 5.12
should I try installing perl from Strawberry? looks like it is a little newer v5.18 ?
is there something I can tweak and re-run cpan installs?
I installed the binaries from imagemagick, from Link first, then cpan again, and cpan still fails....
This is the top part of the build log down to where it really goes south and starts kicking out errors:
cpanm (App::cpanminus) 1.6941 on perl 5.014002 built for MSWin32-x86-multi-thread
Work directory is C:\Users\dtbaker/.cpanm/work/1377281741.8420
You have make C:\Dwimperl\c\bin\dmake.exe
You have LWP 6.03
Falling back to Archive::Tar 1.80
Searching Image::Magick on cpanmetadb ...
--> Working on Image::Magick
Fetching http://www.cpan.org/authors/id/J/JC/JCRISTY/PerlMagick-6.86.tar.gz
-> OK
Unpacking PerlMagick-6.86.tar.gz
Entering PerlMagick-6.86
META.yml/json not found. Creating skelton for it.
Configuring PerlMagick-6.86
Running Makefile.PL
################################### WARNING! ###################################
# It seems that you are trying to install Perl::Magick on a MS Windows box with
# perl + gcc compiler (e.g. strawberry perl), however we cannot find ImageMagick
# binaries installed on your system.
#
# Please check the following prerequisites:
#
# 1) You need to have installed ImageMagick Windows binaries from
# http://www.imagemagick.org/script/binary-releases.php#windows
#
# 2) We only support dynamic (DLL) ImageMagick binaries
# note: it is not possible to mix 32/64-bit binaries of perl and ImageMagick
#
# 3) During installation select that you want to install ImageMagick's
# development files (libraries+headers)
#
# 4) You also need to have ImageMagick's directory in your PATH
# note: we are checking the presence of convert.exe and/or identify.exe tools
#
# 5) You might need Visual C++ Redistributable Package installed on your system
# see instructions on ImageMagick's Binary Release webpage
#
# We are gonna continue, but chances for successful build are very low!
################################################################################
Checking if your kit is complete...
Looks good
Note (probably harmless): No library found for -lMagickCore-6.Q16
Writing Makefile for Image::Magick
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.62)
Building and testing Image-Magick-6.86
cp Magick.pm blib\lib\Image\Magick.pm
AutoSplitting blib\lib\Image\Magick.pm (blib\lib\auto\Image\Magick)
C:\Dwimperl\perl\bin\perl.exe C:\Dwimperl\perl\lib\ExtUtils\xsubpp -typemap C:\Dwimperl\perl\lib\ExtUtils\typemap -typemap typemap Magick.xs > Magick.xsc && C:\Dwimperl\perl\bin\perl.exe -MExtUtils::Command -e mv -- Magick.xsc Magick.c
gcc -c -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"6.86\" -DXS_VERSION=\"6.86\" "-IC:\Dwimperl\perl\lib\CORE" -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c
Magick.xs:60:31: error: magick/MagickCore.h: No such file or directory
Magick.xs:167: error: expected specifier-qualifier-list before 'MagickRealType'
Magick.xs:188: error: expected specifier-qualifier-list before 'ImageInfo'
Magick.xs:210: error: 'MagickNoiseOptions' undeclared here (not in a function)
however we cannot find ImageMagick binaries installed on your system.
Is ImageMagick is in your path, as recommanded in the 4) point? Open cmd.exe and type convert -v or convert.exe -v. If you don't see informations about Image Magick (Windows have a built-in convert command), it is very likely you have to add it to your path.
You also have to check points 1), 3), and 5). After that try again to run installation process through cpanm.
Trying to install for Citrus Perl, I discovered on debugging through the Perl part of the install that the mingw64 install had not included 'pexports.exe'. Downloading that from https://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/
and placing it in the mingw64 directory was necessary to solve the problem of a long list of library export symbols not found.
Prior to that I had also set the environment variables CPATH, C_INCLUDE_PATH, and CPLUS_INCLUDE_PATH to point to the "include" directory of the ImageMagick install include directory in C:\Program Files (x86). (When you install ImageMagick you should check the box to install also for Strawberry Perl.)