inveniosoftware / troubleshooting

DEPRECATED - Use the forum instead:
https://invenio-talk.web.cern.ch
5 stars 4 forks source link

installation: IOError: [Errno 2] No such file or directory #45

Open diegodelemos opened 5 years ago

diegodelemos commented 5 years ago

Problem

While following the Instructions on: https://invenio.readthedocs.io/en/latest/quickstart/quickstart.html all seems fine but, when you open https://127.0.0.1:5000/ you get the following error:

IOError: [Errno 2] No such file or directory: '/home/user/.virtualenvs/my-repository-venv/var/instance/static/scss/invenio_theme/styles.scss'

Which is right, static contains only a package.json. The files needed are located in /lib/python2.7/site-packages/invenio_theme/static.

Solution

Uninstall Invenio from your system Python and use only virtual environments.

Why

This is happening because you have Invenio installed in your system Python, and whenever there is a call to the Invenio CLI inside the scripts, i.e. scripts/bootstrap, it is called instead of the one installed inside the virtual environment.

$ which invenio
/usr/local/bin/invenio
# instead of
$ which invenio
/Users/username/.virtualenvs/the-invenio/bin/invenio

Contributed by @devolt5 in https://github.com/inveniosoftware/invenio/issues/3922.

josircg commented 5 years ago

Hi folks. I have the same error on a new installation but my installation is pointing to the virtualenv correctly. I got:

File "/var/invenio/invenio3/lib/python3.5/site-packages/webassets/merge.py", line 77, in data f = open(self.filename, 'r', encoding='utf-8') FileNotFoundError: [Errno 2] No such file or directory: '/var/invenio/invenio3/var/instance/static/scss/invenio_theme/styles.scss'

diegodelemos commented 5 years ago

Hello @josircg, thanks for trying out Invenio! Could you tell us some more details such as how did you install Invenio?

josircg commented 5 years ago

Following the instructions on https://invenio.readthedocs.io/en/latest/quickstart/quickstart.html

Debian 9. Installation run smoothly. I don't know if this can help but I got a problem on ./scripts/bootstrap because npm was not installed. After fix it, I run bootstrap again and I got no error.

/var/invenio/invenio3/var/instance/static/ has just package.json

$which invenio /var/invenio/invenio3/bin/invenio

devolt5 commented 5 years ago

Check your npm version. I made the mistake and used a version below minimum requirements so that the boostrap process does not compile js and css files.

josircg commented 5 years ago

npm -v: 6.4.1 nodejs -v: v10.15.2

What are the steps to re-run the bootstrap again?

diegodelemos commented 5 years ago

npm -v: 6.4.1 nodejs -v: v10.15.2

What are the steps to re-run the bootstrap again?

Your versions of npm and nodejs are ok now :) You could just run it again, but I would recommend to start from scratch with new virtual environment.

josircg commented 5 years ago

Problem found! I remove the --silent from npm install on setup and found that the user should have root privileges to install the nodejs files.

I'm installing now nodejs as regular user and we try to run bootstrap again. I will give the feedback here.

josircg commented 5 years ago

Hi folks. Solution that works for me installing node inside virtualenv:

1) As root, uninstall node 2) As a regular user, activate invenio virtualenv and install nodeenv:

source ./bin/activate
pip install nodeenv
nodeenv -p
cd <invenio_app_location>
./scripts/bootstrap
./scripts/setup

Source: nodeenv