Forums

Write to /usr/local/lib/ and permission denied

I'm trying to install a package that's not supported by pip, and it needs to write to directory /usr/local/lib/. It seems sudo is not available - how can I get around the permission denied problem? Thanks!

Does this help?

I don't think my package is supported by pip or easyinstall. It's a C++ package with Python bindings. It's a custom package, and I need to run "make install" in the package folder, which writes to /usr/local/lib/. How should I solve the issue? Thanks!

Ah, right. If you've run make on its own before running make install, and it completed without errors, then you should be able to use the package without needing to run it system-wide -- you'll just need to adjust LD_LIBRARY_PATH and PATH. What's the package? Perhaps I can give some more specific instructions with more information.

Thanks! How do I add a directory where Python looks for modules / libraries in PythonAnywhere?

For C/C++ libraries, LD_LIBRARY_PATH determines the search path. So if you define that in your .bashrc then everything that runs from bash will have access to it.

But if you give me a link to the specific package (assuming it's publicly available) I may be able to give more specific instructions.

Thanks. Below is information on the packages I would like to install. The documentations are not in English, and I summarized the installation instructions as below.

MaCab

Documentation (you can use Google translate): http://taku910.github.io/mecab/

Download: https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE

Installation on Unix

tar zxfv mecab-XXtar.gz
cd mecab-XX
./configure 
make
make check
make install

CaboCha

Documentation (you can use Google translate): https://taku910.github.io/cabocha/

Download: https://drive.google.com/uc?id=0B4y35FiV1wh7SDd1Q1dUQkZQaUU&export=download

Installation on Unix

cd cabocha-0.69
./configure
make
make check
make install

Then install for Python

cd cabocha-0.69/python
python setup.py install

Thank you!

OK, so once you've run make on those two, then you should be able to run the binary -- for example, if you compiled mecab in the mecab subdirectory of your home dir, you should be able to run it via something like mecab/src/mecab.

I don't see any instructions on how to install the swig bindings, though. If you compile those, it should output a mecab.pyx file somewhere -- you'd need to add the directory containing that to your PYTHONPATH.

Hello, Sir

After I run "make install" for MaCab as described in above second block,

I got the error

"/usr/bin/install: cannot create regular file '/usr/local/lib/libmecab.so.2.0.0': Permission denied".

Can I install MeCab in pythonanywhere?

Regards.

Probably. Check their docs for how to change the install location to somewhere in your home directory.