使用ReadStat

时间:2017-01-22 00:23:39

标签: import julia

我正在尝试将数据从SAS文件导入Julia。我在网上找到了一个名为ReadStat的软件包,但是当我尝试添加软件包时,我只收到了INFO: Nothing to be done。有人有想法吗?我已经添加了Nullable Arrays包,因为它是ReadStat的依赖项。

感谢您的帮助!

编辑:构建错误如下v0.5(v0.6如下)



julia> Pkg.build("ReadStat")
INFO: Building ReadStat
WARNING: `@windows_only` is deprecated, use `@static if is_windows()` instead
 in depwarn(::String, ::Symbol) at ./deprecated.jl:64
 in @windows_only(::Any) at ./deprecated.jl:488
 in include_from_node1(::String) at ./loading.jl:488
 in evalfile(::String, ::Array{String,1}) at ./loading.jl:504 (repeats 2 times)
 in cd(::##2#4, ::String) at ./file.jl:59
 in (::##1#3)(::IOStream) at ./none:13
 in open(::##1#3, ::String, ::String) at ./iostream.jl:113
 in eval(::Module, ::Any) at ./boot.jl:234
 in process_options(::Base.JLOptions) at ./client.jl:239
 in _start() at ./client.jl:318
while loading /home/ale/.julia/v0.5/ReadStat/deps/build.jl, in expression starting on line 27
INFO: Attempting to Create directory /home/ale/.julia/v0.5/ReadStat/deps/downloads
INFO: Directory /home/ale/.julia/v0.5/ReadStat/deps/downloads already created
INFO: Downloading file https://github.com/WizardMac/ReadStat/releases/download/v0.1.1/readstat-0.1.1.tar.gz
INFO: Done downloading file https://github.com/WizardMac/ReadStat/releases/download/v0.1.1/readstat-0.1.1.tar.gz
INFO: Attempting to Create directory /home/ale/.julia/v0.5/ReadStat/deps/src
INFO: Directory /home/ale/.julia/v0.5/ReadStat/deps/src already created
INFO: Attempting to Create directory /home/ale/.julia/v0.5/ReadStat/deps
INFO: Directory /home/ale/.julia/v0.5/ReadStat/deps already created
INFO: Path /home/ale/.julia/v0.5/ReadStat/deps/src/readstat-0.1.1 already created
INFO: Changing Directory to /home/ale/.julia/v0.5/ReadStat/deps/src/readstat-0.1.1
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for ragel... true
checking for workbook_new in -lxlsxwriter... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
config.status: executing libtool commands

Configuration:

C compiler: gcc
CFLAGS: -g -O2

Host: x86_64-unknown-linux-gnu
Extra libs: -lm
Extra ld flags: 

Ragel: true
Ragel flags: 
INFO: Changing Directory to /home/ale/.julia/v0.5/ReadStat/deps/src/readstat-0.1.1
  CCLD     libreadstat.la
/usr/bin/ld: cannot find -llzma
collect2: error: ld returned 1 exit status
Makefile:805: recipe for target 'libreadstat.la' failed
make: *** [libreadstat.la] Error 1
===============================================================[ ERROR: ReadStat ]================================================================

LoadError: failed process: Process(`make`, ProcessExited(2)) [2]
while loading /home/ale/.julia/v0.5/ReadStat/deps/build.jl, in expression starting on line 34

==================================================================================================================================================

=================================================================[ BUILD ERRORS ]=================================================================

WARNING: ReadStat had build errors.

 - packages with build errors remain installed in /home/ale/.julia/v0.5
 - build the package(s) and all dependencies with `Pkg.build("ReadStat")`
 - build a single package by running its `deps/build.jl` script

==================================================================================================================================================




为v0.6构建错误



julia> Pkg.build("ReadStat")
ERROR: could not spawn `/usr/bin/julia -Cx86-64 -J/usr/lib/x86_64-linux-gnu/julia/sys.so --compile=yes --depwarn=yes -O0 --compilecache=yes --history-file=no --color=yes --eval '    empty!(Base.LOAD_PATH)
    append!(Base.LOAD_PATH, String["/usr/local/share/julia/site/v0.6","/usr/share/julia/site/v0.6"])
    empty!(Base.LOAD_CACHE_PATH)
    append!(Base.LOAD_CACHE_PATH, String["/home/ale/.julia/lib/v0.6"])
    empty!(Base.DL_LOAD_PATH)
    append!(Base.DL_LOAD_PATH, String[])
    open("/tmp/juliap9Er9x", "a") do f
        for path_ in eachline(STDIN)
            path = chomp(path_)
            pkg = basename(dirname(dirname(path)))
            try
                info("Building $pkg")
                cd(dirname(path)) do
                    evalfile(path)
                end
            catch err
                Base.Pkg.Entry.warnbanner(err, label="[ ERROR: $pkg ]")
                serialize(f, pkg)
                serialize(f, err)
            end
        end
    end
'`: no such file or directory (ENOENT)
 in _jl_spawn(::String, ::Array{String,1}, ::Ptr{Void}, ::Base.Process, ::Base.PipeEndpoint, ::Base.TTY, ::Base.TTY) at ./process.jl:364
 in #423 at ./process.jl:516 [inlined]
 in setup_stdio(::Base.##423#424{Cmd}, ::Tuple{Pipe,Base.TTY,Base.TTY}) at ./process.jl:502
 in #spawn#422(::Nullable{Base.ProcessChain}, ::Function, ::Cmd, ::Tuple{Pipe,Base.TTY,Base.TTY}) at ./process.jl:515
 in (::Base.#kw##spawn)(::Array{Any,1}, ::Base.#spawn, ::Cmd, ::Tuple{Pipe,Base.TTY,Base.TTY}) at ./<missing>:0
 in #spawn#419(::Nullable{Base.ProcessChain}, ::Function, ::Base.CmdRedirect, ::Tuple{Pipe,Base.TTY,Base.TTY}) at ./process.jl:396
 in spawn(::Base.CmdRedirect, ::Tuple{Pipe,Base.TTY,Base.TTY}) at ./process.jl:396
 in open(::Base.CmdRedirect, ::String, ::Base.TTY) at ./process.jl:586
 in build!(::Array{String,1}, ::Dict{Any,Any}, ::Set{Any}) at ./pkg/entry.jl:622
 in build(::Array{String,1}) at ./pkg/entry.jl:650
 in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#build,Tuple{Array{String,1}}})() at ./pkg/dir.jl:31
 in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#build,Tuple{Array{String,1}}}, ::String) at ./file.jl:69
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::Array{String,1}, ::Vararg{Array{String,1},N}) at ./pkg/dir.jl:31
 in build(::String, ::Vararg{String,N}) at ./pkg/pkg.jl:236
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:2)

以下安装包并为我工作。 最好在每一步后退出并重新启动julia。

Pkg.clone("https://github.com/WizardMac/ReadStat.jl.git")
Pkg.build("ReadStat")
Pkg.add("ReadStat")
Pkg.update()
using ReadStat

在最后一点,它将开始预编译。我下载的版本中有一个小错误(在预编译过程中出现错误),我必须手动更正:

ReadStat.jl,第44行,将Uint8更改为UInt8(即资本&#39; I&#39;)。