Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with installing on Ubuntu #42

Closed
kholtman opened this issue Mar 18, 2021 · 3 comments
Closed

Issues with installing on Ubuntu #42

kholtman opened this issue Mar 18, 2021 · 3 comments

Comments

@kholtman
Copy link

kholtman commented Mar 18, 2021

..just tried to install pycid on my Ubuntu (20.04) system. I ran into some problems following the current instructions, figure I should report them so that they can be improved. The current instructions are:

git clone https://github.com/causalincentives/pycid # download the code
cd pycid
pip3 install --editable .[test]
python3 -m pytest # check that everything works

Minor problems: I had to do

sudo apt install python3-pip
sudo apt install python3-testresources

to get some needed python3 components.

More significantly,

pip3 install --editable .[test]

did not create a fully working install, but produced a long error message including:

   [Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/test-easy-install-11670.write-test'

Digging down, the clean solution to this would have been to add the option -t ~/.local/lib/python3.8/ to the pip3 command line, but this does not work, as for some reason --editable is incompatible with using the -t ~/.local/lib/python3.8/ option, see for example here: pypa/pip#4390 . So in terms of updating the pycid installation instructions to help Ubuntu users, I have identified two possible solution paths leading to a clean install:

Solution 1 (not recommended on multiuser systems): change permissions on /usr/local/lib/python3.8/dist-packages/ to make it writable, e.g. do

sudo chown `whoami` /usr/local/lib/python3.8/dist-packages/

before running the pip3 install command.

Solution 2: omit the --editable flag and do:

pip3 install .[test]

This copies the cloned repository files to ~/.local/lib/python3.8/site-packages/ , so less useful if you want to edit these files in developer mode.

@edlanglois
Copy link
Contributor

edlanglois commented Mar 18, 2021

I strongly recommend against chown /usr/local/lib/python3.8/dist-packages/, even on single user systems. You probably want let your package manager manage that and not mess with system packages.

I'll clarify this in the README but the options I recommend are:
Option 1 for development
Create and activate a virtual environment then install to the virtual environment with

pip3 install --editable .[test]

Option 2 for development
Install to $HOME. This doesn't let you specify [test] so those packages have to be installed manually.

python3 setup.py develop --user
pip3 install --user flake8 ipykernel mypy nbconvert nbformat pep8-naming pytest

And for non-development usage:
Option 1 for users
Coming soon. Create a virtual environment and run

pip3 install pycid

or pip3 install --user pycid if not using a virtual environment.

Option 2 for users

pip3 install .  # If in a virtual environment
#or
pip3 install --user . # If not in a virtual environment

@edlanglois
Copy link
Contributor

Another option is to use a conda environment.

Closing since the suggestion to use a virtual environment or conda is now in the README.

@kholtman
Copy link
Author

kholtman commented Mar 18, 2021

Thanks! Tried the new instructions with a virtual environment on my Ubuntu box (with /usr/local/lib/python3.8/dist-packages/ owned by root again, as default in an Ubuntu install) and I can confirm it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants