0

I was trying to install python 3.7.4 on a freebsd machine. At the end of make install the error popped out.

ModuleNotFoundError: No module named '_ctypes'

Libffi is installed by source and its prefix was set to $HOME/lib/libffi

Attempt 1. I've tried installing cpython, and it installed setuptools successfully at the end of make install. Then when I was installing numpy by source, The same error appeared.

So I deleted cpython and tried to install the regular one again.

Attempt 2. According to this thread I added the some stuffs while doing ./configure. The full command was:

./configure --enable-optimizations --prefix=$HOME/programs/python --enable-shared LDFLAGS="-L$HOME/lib" CPPFLAGS="-I $HOME/lib/libffi/lib/libffi-3.2.1/include"

but the same error popped out at the end of make install

Attempt 3. I've tried to force install an anaconda on it, but it didn't work.

Side note 1: yum and did not exist on the machine, and I don't have the root access.

Side note 2: I've deleted every -fprofile-correction in Makefile, since the machine doesn't recognize it.

Side note 3: this is found near the end of make:

Python build finished successfully!
(...)
Failed to build these modules:
_ctypes
aoaaceai
  • 33
  • 1
  • 7
  • You have to go back in the log, and check why *\_ctypes* failed to build (probably it couldn't find the *libffi* library at link time?). – CristiFati Aug 31 '19 at 14:09
  • The log file did not contain the reason. The only thing associated is `building '_ctypes_test'`, and no error message was shown. – aoaaceai Sep 01 '19 at 00:42
  • I'd rather install it using packages. Command "sudo pkg install python37" will install python-3.7.4 with zero problems. In general installation from the source is the last resort when software cannot be found in packages or ports. – Yuri Ginsburg Sep 01 '19 at 06:17
  • Nope, it doesn't contain pkg, either. The build of yum and pkg both failed. – aoaaceai Sep 02 '19 at 03:10

1 Answers1

0

It is almost always a mistake for a FreeBSD user to build a software package, that's already been officially ported to the OS, himself.

What you should do instead is:

    cd /usr/ports/lang/python37
    make install clean
Mikhail T.
  • 3,043
  • 3
  • 29
  • 46
  • However, the files there only contains python23~python25. is there a way to update that? – aoaaceai Sep 22 '19 at 09:45
  • Your ports-collection is _severely_ out of date -- the [lang/python37](https://www.freshports.org/lang/python37) port is more than a year old. Refresh the `/usr/ports/` using one of [these methods](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html) and try again. – Mikhail T. Sep 24 '19 at 02:57