【问题标题】:pip3 can't install jq on macOS due to ruby dependencies由于 ruby​​ 依赖,pip3 无法在 macOS 上安装 jq
【发布时间】:2021-04-09 20:05:15
【问题描述】:

我正在尝试使用以下命令在我的虚拟 pyenv 环境中安装特定的 jq 版本:

pip3 install -r requirements.txt

requirements.txt 有这一行:jq==1.0.2

错误信息:

Downloaded https://github.com/stedolan/jq/releases/download/jq-1.6/jq-1.6.tar.gz
    Executing: autoreconf -i
    glibtoolize: putting auxiliary files in '.'.
    glibtoolize: copying file './ltmain.sh'
    glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
    glibtoolize: copying file 'm4/libtool.m4'
    glibtoolize: copying file 'm4/ltoptions.m4'
    glibtoolize: copying file 'm4/ltsugar.m4'
    glibtoolize: copying file 'm4/ltversion.m4'
    glibtoolize: copying file 'm4/lt~obsolete.m4'
    configure.ac:7: warning: The macro `AC_CONFIG_HEADER' is obsolete.
    configure.ac:7: You should run autoupdate.
    ./lib/autoconf/status.m4:719: AC_CONFIG_HEADER is expanded from...
    configure.ac:7: the top level
    configure.ac:36: warning: The macro `AM_PROG_LIBTOOL' is obsolete.
    configure.ac:36: You should run autoupdate.
    m4/libtool.m4:100: AM_PROG_LIBTOOL is expanded from...
    configure.ac:36: the top level
    configure.ac:46: warning: The macro `AC_HEADER_STDC' is obsolete.
    configure.ac:46: You should run autoupdate.
    ./lib/autoconf/headers.m4:704: AC_HEADER_STDC is expanded from...
    configure.ac:46: the top level
    configure.ac:54: warning: The macro `AC_HEADER_TIME' is obsolete.
    configure.ac:54: You should run autoupdate.
    ./lib/autoconf/headers.m4:743: AC_HEADER_TIME is expanded from...
    configure.ac:54: the top level
    configure.ac:60: warning: The macro `AC_TRY_COMPILE' is obsolete.
    configure.ac:60: You should run autoupdate.
    ./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
    lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
    lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
    ./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
    ./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
    configure.ac:60: the top level
    configure.ac:68: warning: The macro `AC_TRY_COMPILE' is obsolete.
    configure.ac:68: You should run autoupdate.
    ./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
    lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
    lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
    ./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
    ./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
    configure.ac:68: the top level
    configure.ac:87: warning: AC_OUTPUT should be used without arguments.
    configure.ac:87: You should run autoupdate.
    configure.ac:17: warning: The macro `AC_PROG_CC_STDC' is obsolete.
    configure.ac:17: You should run autoupdate.
    ./lib/autoconf/c.m4:1666: AC_PROG_CC_STDC is expanded from...
    configure.ac:17: the top level
    configure.ac:59: warning: The macro `AC_HELP_STRING' is obsolete.
    configure.ac:59: You should run autoupdate.
    ./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
    configure.ac:59: the top level
    configure.ac:64: warning: The macro `AC_HELP_STRING' is obsolete.
    configure.ac:64: You should run autoupdate.
    ./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
    configure.ac:64: the top level
    configure.ac:68: warning: The macro `AC_HELP_STRING' is obsolete.
    configure.ac:68: You should run autoupdate.
    ./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
    configure.ac:68: the top level
    configure.ac:72: warning: The macro `AC_HELP_STRING' is obsolete.
    configure.ac:72: You should run autoupdate.
    ./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
    configure.ac:72: the top level
    configure.ac:76: warning: The macro `AC_HELP_STRING' is obsolete.
    configure.ac:76: You should run autoupdate.
    ./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
    configure.ac:76: the top level
    configure.ac:80: warning: The macro `AC_HELP_STRING' is obsolete.
    configure.ac:80: You should run autoupdate.
    ./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
    configure.ac:80: the top level
    configure.ac:84: warning: The macro `AC_HELP_STRING' is obsolete.
    configure.ac:84: You should run autoupdate.
    ./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
    configure.ac:84: the top level
    configure.ac:135: warning: The macro `AC_HELP_STRING' is obsolete.
    configure.ac:135: You should run autoupdate.
    ./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
    ./lib/autoconf/general.m4:1534: AC_ARG_ENABLE is expanded from...
    configure.ac:135: the top level
    Executing: ./configure CFLAGS=-fPIC --disable-maintainer-mode --with-oniguruma=/private/var/folders/fb/bh6d9vgn3lndrfb8k3gxmb5r0000gn/T/pip-install-77pax3w4/jq/_deps/onig-install-6.9.4
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a race-free mkdir -p... ./config/install-sh -c -d
    checking for gawk... no
    checking for mawk... no
    checking for nawk... no
    checking for awk... awk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking whether make supports nested variables... (cached) yes
    checking whether make supports the include directive... yes (GNU style)
    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 the compiler supports GNU C... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to enable C11 features... none needed
    checking whether gcc understands -c and -o together... yes
    checking dependency style of gcc... gcc3
    checking for ar... ar
    checking the archiver (ar) interface... ar
    checking whether to enable maintainer-specific portions of Makefiles... no
    checking for gcc... (cached) gcc
    checking whether the compiler supports GNU C... (cached) yes
    checking whether gcc accepts -g... (cached) yes
    checking for gcc option to enable C11 features... (cached) none needed
    checking whether gcc understands -c and -o together... (cached) yes
    checking dependency style of gcc... (cached) gcc3
    checking how to run the C preprocessor... gcc -E
    checking for bison... bison -y
    checking build system type... x86_64-apple-darwin20.3.0
    checking host system type... x86_64-apple-darwin20.3.0
    checking how to print strings... printf
    checking for a sed that does not truncate output... /usr/bin/sed
    checking for grep that handles long lines and -e... /usr/bin/grep
    checking for egrep... /usr/bin/grep -E
    checking for fgrep... /usr/bin/grep -F
    checking for ld used by gcc... /Library/Developer/CommandLineTools/usr/bin/ld
    checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
    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... 786432
    checking how to convert x86_64-apple-darwin20.3.0 file names to x86_64-apple-darwin20.3.0 format... func_convert_file_noop
    checking how to convert x86_64-apple-darwin20.3.0 file names to toolchain format... func_convert_file_noop
    checking for /Library/Developer/CommandLineTools/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 archiver @FILE support... no
    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... no
    checking if : is a manifest tool... no
    checking for dsymutil... dsymutil
    checking for nmedit... nmedit
    checking for lipo... lipo
    checking for otool... otool
    checking for otool64... no
    checking for -single_module linker flag... yes
    checking for -exported_symbols_list linker flag... yes
    checking for -force_load linker flag... yes
    checking for stdio.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for strings.h... yes
    checking for sys/stat.h... yes
    checking for sys/types.h... yes
    checking for unistd.h... yes
    checking for dlfcn.h... yes
    checking for objdir... .libs
    checking if gcc supports -fno-rtti -fno-exceptions... yes
    checking for gcc option to produce PIC... -fno-common -DPIC
    checking if gcc PIC flag -fno-common -DPIC works... yes
    checking if gcc static flag -static works... no
    checking if gcc supports -c -o file.o... yes
    checking if gcc supports -c -o file.o... (cached) yes
    checking whether the gcc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
    checking dynamic linker characteristics... darwin20.3.0 dyld
    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... yes
    checking for valgrind... no
    configure: WARNING: valgrind is required to test jq.
    checking for memmem... yes
    checking for mkstemp... yes
    checking for shlwapi.h... no
    checking for bundle... bundle
    checking for Ruby dependencies... configure: WARNING: The following gems are missing
     * rake (10.4.2)
     * i18n (0.7.0)
     * json (1.8.3)
     * minitest (5.8.0)
     * thread_safe (0.3.5)
     * tzinfo (1.2.2)
     * activesupport (4.2.3)
     * addressable (2.3.8)
     * builder (3.2.2)
     * launchy (2.4.3)
     * liquid (3.0.6)
     * maruku (0.7.2)
     * rack (1.6.4)
     * sass (3.4.16)
     * rack-protection (1.5.3)
     * tilt (2.0.1)
     * sinatra (1.4.6)
     * watch (0.1.0)
     * yui-compressor (0.12.0)
     * bonsai (1.4.9)
     * hpricot (0.8.6)
     * mustache (0.99.8)
     * rdiscount (2.1.8)
     * ronn (0.7.3)
    Install missing gems with `bundle install`
    *****************************************************************
    *  Ruby dependencies for building jq documentation not found.   *
    *  You can still build, install and hack on jq, but the manpage *
    *  will not be rebuilt and some of the tests will not run.      *
    *  See docs/README.md for how to install the docs dependencies. *
    *****************************************************************
    no

看起来这个错误是由于缺少 Ruby 依赖项造成的。我在jq documentation 上看到了

(2) 如果您收到涉及 pipenv 的错误消息并且您不需要 要“构建”的文档,然后将 --disable-docs 标志添加到 ./configure,例如

./configure --disable-docs

但是我通过pip3安装jq的时候不知道怎么使用这个configure参数。

documentation 还展示了如何为文档安装依赖项:

Install Dependencies (RVM, for docs)

Note that as of February 26, 2019, ruby is no longer a dependency for building jq from "master"; python is used instead. If make fails because of python, run configure with the --disable-docs command-line option.

Note also that curl | bash is a best practice...

cd ~/jq/docs
curl -L https://get.rvm.io | bash -s stable --ruby=1.9.3
cd docs
bundle install

但是,当我在虚拟环境中通过 pip3 进行 jq 安装时,我不确定应该如何执行这些步骤。

jq 文档(当前版本)中的README.md 文件解释了如何构建文档,但同样,我不确定在虚拟环境中使用 pip3 时如何遵循这些步骤。

jq 文档对我来说并不重要。我只想正确安装jq。

有什么建议吗?

【问题讨论】:

  • "requirements.txt 有这一行:jq==1.0.2" 所以它试图安装一个古老版本的 jq?除非你的操作系统不支持它,否则你应该使用最新的或至少是最新的版本。
  • @JeffMercado 不幸的是我必须使用这个版本。
  • @JeffMercado 顺便说一句,看起来 pip3 确实尝试安装 v1.6。请参阅问题中错误消息的第一行:“Downloaded github.com/stedolan/jq/releases/download/jq-1.6/jq-1.6.tar.gz
  • @Jeff Mercado,回复“所以它正在尝试安装旧版本的 jq?”,不,它正在安装 1.6(“已下载 https://. ../jq-1.6.tar.gz")
  • @ikegami:从输出中我很清楚它实际上是在安装 1.6。但我不知道jq==1.0.2 在这种情况下是什么意思,我只能假设意图是安装那个版本。

标签: python ruby pip jq


【解决方案1】:

我没想到会这样,但是在我用这个命令更新pip3之后这个问题已经解决了:

pip3 install --upgrade pip

然后我用同样的命令安装需求,这次jq安装成功:

pip3 install -r requirements.txt

【讨论】:

  • 但是最终安装了哪个版本的 jq?
  • 我猜是pip包版本,不是jq。 pypi.org/project/jq/1.0.2
  • 是的,@JeffMercado,v1.0.2 已安装。
【解决方案2】:

但是我通过pip3安装jq的时候不知道怎么使用这个configure参数。

wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-1.6.tar.gz
tar xvzf jq-1.6.tar.gz
cd jq-1.6
./configure --disable-docs
make -j8
make check

【讨论】:

  • (另一个答案显然更好,但认为对所提出的问题有一个答案会很好。)
  • 感谢您的意见@ikegami。您共享的代码会在 pyenv 虚拟环境中进行编译吗?我只是想确定一下。
  • pyenv 似乎是一个 PATH 操作工具。据推测,安装程序使用PATH中的第一个pythonpython3,所以是的
猜你喜欢
  • 2020-05-30
  • 1970-01-01
  • 1970-01-01
  • 2017-06-14
  • 2016-12-01
  • 2014-03-07
  • 1970-01-01
  • 2015-09-22
  • 1970-01-01
相关资源
最近更新 更多