aconrad / pycobertura

A code coverage diff tool for Cobertura reports
MIT License
116 stars 39 forks source link

Installation without admin rights - How do I use after installation with python setup.py install --user ? #181

Closed nbauma109 closed 6 months ago

nbauma109 commented 7 months ago

I have installed successfully thanks to command:

python setup.py install --user

What do I need to run in order to use pycobertura ?

I tried :

But it didn't work for me. install_log_pycobertua.log

aconrad commented 7 months ago

Both options should work. If it says "command not found", then maybe you can call the pycobertura script directly, which should be located in the bin directory of your Python installation directory (usually located where the command python3 -m site --user-base says).

For me it's ~/Library/Python/3.11/bin/pycobertura.

nbauma109 commented 7 months ago

I think I was almost there. I have setup my PYTHONPATH to the site-packages directory but I still have command not found or module not found.

aconrad commented 7 months ago

PYTHONPATH will tell Python where to find installed packages. If you run python3 you should be able to import pycobertura without ImportError. If that works, then pycobertura is properly installed for you.

➜  python3
Python 3.11.6 (v3.11.6:8b6ee5ba3b, Oct  2 2023, 11:18:21) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycobertura
>>> 

And thus, python3 -m pycobertura should work as well.

If you want the command pycobertura to work from your shell, you'll have to tweak your PATH (this one is used by your shell) to tell it where to look for executables. So when you type pycobertura, your shell will look inside each path defined in PATH and look for that command. If it goes through all paths and fails to find it, it will say command not found.

I took a closer look at your log file, writing UNKNOWN.egg-info/PKG-INFO doesn't look right to me. Not sure how to fix it though...

Note: I see you are using Python 2. We've deprecated python2 a while ago and I doubt pycobertura will work if you manage to install it. I suggest you try installing pycobertura with Python 3.