aniketpanjwani / chomper

Internet blocker for the Linux desktop.
https://addictedto.tech/chomper/
GNU General Public License v3.0
356 stars 43 forks source link

Problems with Makefile installation on Debian. #30

Open aniketpanjwani opened 6 years ago

aniketpanjwani commented 6 years ago
Steps to reproduce the problem:
  1. Run make init, and get errors with either pipenv installation or python path.
Any other comments? What have you tried so far?

For some reason, the previous issue (issue #26) which dealt with this problem got deleted. I have no idea how this occurred. I'm recreating this issue and leaving it open so that the people who were involved will be able to find it, but this issue was solved in 4afd3b2.

System information

Operating system: (e.g. Linux Mint 18)

dufywihi commented 6 years ago

Really appreciate you re-opening this issue. Not sure why GitHub closed the issue. Tried running make but get another error. What do you think?

curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
100   148  100   148    0     0     33      0  0:00:04  0:00:04 --:--:--    33
100  2105  100  2105    0     0    236      0  0:00:08  0:00:08 --:--:--   533
echo "export PATH='$HOME/.pyenv/bin:$PATH'" >> /home/dufy/.bashrc
source /home/dufy/.bashrc
echo "eval ''" >> /home/dufy/.bashrc
source /home/dufy/.bashrc
pyenv update
Updating /home/dufy/.pyenv...
From https://github.com/pyenv/pyenv
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Updating /home/dufy/.pyenv/plugins/pyenv-doctor...
From https://github.com/pyenv/pyenv-doctor
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Updating /home/dufy/.pyenv/plugins/pyenv-installer...
From https://github.com/pyenv/pyenv-installer
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Updating /home/dufy/.pyenv/plugins/pyenv-update...
From https://github.com/pyenv/pyenv-update
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Updating /home/dufy/.pyenv/plugins/pyenv-virtualenv...
From https://github.com/pyenv/pyenv-virtualenv
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Updating /home/dufy/.pyenv/plugins/pyenv-which-ext...
From https://github.com/pyenv/pyenv-which-ext
 * branch            master     -> FETCH_HEAD
Already up-to-date.
pyenv install 3.6.4
Downloading Python-3.6.4.tar.xz...
-> https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
Installing Python-3.6.4...

BUILD FAILED (Debian 9.3 using python-build 20160602)

Inspect or clean up the working tree at /tmp/python-build.20180316003315.18855
Results logged to /tmp/python-build.20180316003315.18855.log

Last 10 log lines:
  File "/tmp/python-build.20180316003315.18855/Python-3.6.4/Lib/ensurepip/__init__.py", line 204, in _main
    default_pip=args.default_pip,
  File "/tmp/python-build.20180316003315.18855/Python-3.6.4/Lib/ensurepip/__init__.py", line 117, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/tmp/python-build.20180316003315.18855/Python-3.6.4/Lib/ensurepip/__init__.py", line 27, in _run_pip
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available
Makefile:1099: recipe for target 'install' failed
make[1]: *** [install] Error 1
make[1]: Leaving directory '/tmp/python-build.20180316003315.18855/Python-3.6.4'
Makefile:16: recipe for target 'init' failed
make: *** [init] Error 1
dufywihi commented 6 years ago

Here's the tail of the python-build.2018*.log. Your python is a lot better than mine, maybe you'll find it helpful? If you need the entire log, let me know.

rm /home/dufy/.pyenv/versions/3.6.4/lib/python3.6/lib-dynload/_sysconfigdata_m_linux_x86_64-linux-gnu.py
rm -r /home/dufy/.pyenv/versions/3.6.4/lib/python3.6/lib-dynload/__pycache__
Creating directory /home/dufy/.pyenv/versions/3.6.4/share/man
Creating directory /home/dufy/.pyenv/versions/3.6.4/share/man/man1
/usr/bin/install -c -m 644 ./Misc/python.man \
    /home/dufy/.pyenv/versions/3.6.4/share/man/man1/python3.6.1
if test ! -d /home/dufy/.pyenv/versions/3.6.4/lib/pkgconfig; then \
    echo "Creating directory /home/dufy/.pyenv/versions/3.6.4/lib/pkgconfig"; \
    /usr/bin/install -c -d -m 755 /home/dufy/.pyenv/versions/3.6.4/lib/pkgconfig; \
fi
if test -f /home/dufy/.pyenv/versions/3.6.4/bin/python3 -o -h /home/dufy/.pyenv/versions/3.6.4/bin/python3; \
then rm -f /home/dufy/.pyenv/versions/3.6.4/bin/python3; \
else true; \
fi
(cd /home/dufy/.pyenv/versions/3.6.4/bin; ln -s python3.6 python3)
if test "3.6" != "3.6m"; then \
    rm -f /home/dufy/.pyenv/versions/3.6.4/bin/python3.6-config; \
    (cd /home/dufy/.pyenv/versions/3.6.4/bin; ln -s python3.6m-config python3.6-config); \
    rm -f /home/dufy/.pyenv/versions/3.6.4/lib/pkgconfig/python-3.6m.pc; \
    (cd /home/dufy/.pyenv/versions/3.6.4/lib/pkgconfig; ln -s python-3.6.pc python-3.6m.pc); \
fi
rm -f /home/dufy/.pyenv/versions/3.6.4/bin/python3-config
(cd /home/dufy/.pyenv/versions/3.6.4/bin; ln -s python3.6-config python3-config)
rm -f /home/dufy/.pyenv/versions/3.6.4/lib/pkgconfig/python3.pc
(cd /home/dufy/.pyenv/versions/3.6.4/lib/pkgconfig; ln -s python-3.6.pc python3.pc)
rm -f /home/dufy/.pyenv/versions/3.6.4/bin/idle3
(cd /home/dufy/.pyenv/versions/3.6.4/bin; ln -s idle3.6 idle3)
rm -f /home/dufy/.pyenv/versions/3.6.4/bin/pydoc3
(cd /home/dufy/.pyenv/versions/3.6.4/bin; ln -s pydoc3.6 pydoc3)
rm -f /home/dufy/.pyenv/versions/3.6.4/bin/2to3
(cd /home/dufy/.pyenv/versions/3.6.4/bin; ln -s 2to3-3.6 2to3)
rm -f /home/dufy/.pyenv/versions/3.6.4/bin/pyvenv
(cd /home/dufy/.pyenv/versions/3.6.4/bin; ln -s pyvenv-3.6 pyvenv)
if test "x" != "x" ; then \
    rm -f /home/dufy/.pyenv/versions/3.6.4/bin/python3-32; \
    (cd /home/dufy/.pyenv/versions/3.6.4/bin; ln -s python3.6-32 python3-32) \
fi
rm -f /home/dufy/.pyenv/versions/3.6.4/share/man/man1/python3.1
(cd /home/dufy/.pyenv/versions/3.6.4/share/man/man1; ln -s python3.6.1 python3.1)
if test "xupgrade" != "xno"  ; then \
    case upgrade in \
        upgrade) ensurepip="--upgrade" ;; \
        install|*) ensurepip="" ;; \
    esac; \
     ./python -E -m ensurepip \
        $ensurepip --root=/ ; \
fi
Traceback (most recent call last):
  File "/tmp/python-build.20180316003315.18855/Python-3.6.4/Lib/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/tmp/python-build.20180316003315.18855/Python-3.6.4/Lib/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/python-build.20180316003315.18855/Python-3.6.4/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/tmp/python-build.20180316003315.18855/Python-3.6.4/Lib/ensurepip/__init__.py", line 204, in _main
    default_pip=args.default_pip,
  File "/tmp/python-build.20180316003315.18855/Python-3.6.4/Lib/ensurepip/__init__.py", line 117, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/tmp/python-build.20180316003315.18855/Python-3.6.4/Lib/ensurepip/__init__.py", line 27, in _run_pip
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available
Makefile:1099: recipe for target 'install' failed
make[1]: *** [install] Error 1
make[1]: Leaving directory '/tmp/python-build.20180316003315.18855/Python-3.6.4'
aniketpanjwani commented 6 years ago

The relevant part of the error message here is zlib not available. In the previous Github issue, I had pasted my Vagrantfile and provisioning script I used to setup my Debian VM, and I installed zlib as part of the provisioning.

The provisioing script was

#!/bin/bash

# Get build tools
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install git build-essential curl zlib1g-dev libbz2-dev libsqlite3-dev libreadline-dev libncurses5-dev libssl-dev libgdbm-dev python-pip

# Clone chomper and install
git clone https://github.com/aniketpanjwani/chomper.git
cd chomper && git checkout iss26

It might make sense to integrate this into the Makefile rule. For now, just do sudo apt-get -y install zlib1g-dev, and the init rule should work.

dufywihi commented 6 years ago

So close. Installing zlib1g* and other dependencies resolved the previous error. But now:

pipenv install --dev --python 3.6.4 # Install packages
Warning: Python 3.6.4 was not found on your system…
You can specify specific versions of Python with:
  $ pipenv --python path/to/python
/home/dufy/.local/lib/python2.7/site-packages/pipenv/utils.py:1152: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/pipenv-IW_pOx-requirements'>
  warnings.warn(warn_message, ResourceWarning)
Makefile:16: recipe for target 'init' failed
make: *** [init] Error 1
aniketpanjwani commented 6 years ago

This is weird - the installer script should have put pyenv at the head of your path, which should avoid this. Bit busy right now, but will investigate in detail on Saturday. However, if you make progress, let me know.

dufywihi commented 6 years ago

So, using the installer.sh, here's what gets added to bottom of my ~/.bashrc, does it look correct?

export PATH='/home/dufy/.pyenv/bin:/home/dufy/chomper/bin:/home/dufy/.pyenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games'
eval ''

What's the functional purpose of adding this to the bashrc? To make chomper available in any terminal?

aniketpanjwani commented 6 years ago

The purpose is to make the chomper executable available in any terminal. I think it makes sense to have this in the installer, rather than as a manual optional step, since it's very annoying to have to direct to the /bin directory each time.

However, I'm not sure why /usr/local/games and /usr/games/ are being added to your PATH. The others make sense: /.pyenv/bin and /.pyenv/bin are added to your PATH to find mitmdump and Python 3.6.4. /usr/local/bin, /usr/bin, and /bin should be added to ensure that one can find cron.

Additionally, the installation should be appending to the PATH, rather than replacing the PATH. Have to fix that.