fplll / fpylll

A Python interface for https://github.com/fplll/fplll
GNU General Public License v2.0
123 stars 62 forks source link

E: Unable to locate package python3-fpylll #214

Closed demining closed 1 year ago

demining commented 3 years ago

Trying to install Fpylll package on Ubuntu as per the doc:

LINK

Update the package index:

# sudo apt-get update

Install python3-fpylll deb package:

# sudo apt-get install python3-fpylll

I receive a notification:

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package python3-fpylll

How to install on Ubuntu? How can this problem be solved?

cr-marcstevens commented 3 years ago

Which version of Ubuntu do you have?

What is the result of the following command?: apt-cache search fpylll

demining commented 3 years ago

@cr-marcstevens

Description:    Ubuntu 18.04.5 LTS
Codename:   bionic

With the command: apt-cache search fpylll

python-fpylll - Python wrapper for LLL-reduction of Euclidean lattices -- Python
python-fpylll-doc - Python wrapper for LLL-reduction of Euclidean lattices -- doc
cr-marcstevens commented 3 years ago

The supplied doc link is for Ubuntu 21.04 and is based on python3. For Ubuntu 18.04 the corresponding link is https://ubuntu.pkgs.org/18.04/ubuntu-universe-amd64/python-fpylll_0.3.0+ds-3build1_amd64.deb.html.

Simply use sudo apt-get install python-fpylll instead, which seems to be based on python2.7.

demining commented 3 years ago

@cr-marcstevens Do I really need everything to work in python3? Please help me install fpylll for Ubuntu version 18.04? I need to run a program that only works in python3 and I really need to install fpylll. How can this problem be solved?

cr-marcstevens commented 3 years ago

You don't need python3 for fpylll, python2 is fine. So it's fine to install fpylll using sudo apt-get install python-fpylll.

However if you need to use python3 for some other application and the python3-fpylll package is not available then you can still manually build and install fpylll for python3 locally by hand by reading the instructions: https://github.com/fplll/fpylll/blob/master/README.rst

You should change one thing though: instead of ./bootstrap.sh you should use PYTHON=python3 ./bootstrap.sh.

demining commented 3 years ago

@cr-marcstevens
I did as you said, cloned the Fpylll repositories, then ran the command: PYTHON = python3 ./bootstrap.sh and got an error. I posted a very long error record in the document at the link: https://pastebin.com/gncdfP8M

cr-marcstevens commented 3 years ago

You are missing at least autoconf:

sudo apt install autoconf

demining commented 3 years ago

@cr-marcstevens I also get an error: https://pastebin.com/MpgLWS03

cr-marcstevens commented 3 years ago

The hint is in the error log:

ERROR: Unable to locate GNU Libtool.
ERROR:  To prepare the fplll build system from scratch,
        at least version 1.4.2 of GNU 
demining commented 3 years ago

@cr-marcstevens What does it mean? What should I look at and fix?

cr-marcstevens commented 3 years ago

Install libtool:

sudo apt install libtool

demining commented 3 years ago

@cr-marcstevens I followed all the necessary commands that you described. After I ran the command: PYTHON = python3 ./bootstrap.sh

I get a notification

Installed /content/fpylll/fpylll-env/lib/python3.7/site-packages/fpylll-0.5.6-py3.7-linux-x86_64.egg
Processing dependencies for fpylll==0.5.6
Finished processing dependencies for fpylll==0.5.6
Don't forget to activate environment each time:

Now I execute the command as described in README.rst

source ./activate

I get a notification:

/bin/sh: 1: source: not found

What should I do next?

cr-marcstevens commented 3 years ago

In some shells source is not a valid command to read a script, in those cases you case use . instead, so: . activate

demining commented 3 years ago

@cr-marcstevens

I executed on command:

chmod + x activate
./activate

When I run my script, I get the error:

python3 script.py
Traceback (most recent call last):
  File "script.py", line 35, in <module>
    from fpylll import LLL, BKZ, IntegerMatrix
ImportError: cannot import name 'LLL' from 'fpylll' (unknown location)

I raised the question earlier on askubuntu

https://askubuntu.com/questions/1363992/bin-sh-1-source-not-found/1363998?noredirect=1#comment2340523_1363998

I quote

I was answered by jpbrain

Activate only sets enviroment variables to point to the Libs and bootstrap.sh is a shell script. Take a look at https://github.com/fplll/fpylll/blob/master/bootstrap.sh on lines 33-39 and 50-55. Those lines set enviroment variables. - So you need to set your enviroment correctly to be able to run it. what do you get with "env" and "env python"

What should I change in bootstrap.sh to set up the environment correctly?