khoj icon indicating copy to clipboard operation
khoj copied to clipboard

Conflicting dependencies when installing

Open AtomicNess123 opened this issue 1 year ago • 8 comments

How to fix this problem?

ERROR: Cannot install khoj-assistant==0.1.0, khoj-assistant==0.1.2, khoj-assistant==0.1.3 and khoj-assistant==0.1.4 because these package versions have conflicting dependencies.

The conflict is caused by:
    khoj-assistant 0.1.4 depends on numpy==1.22.4
    khoj-assistant 0.1.3 depends on numpy==1.22.4
    khoj-assistant 0.1.2 depends on numpy==1.22.4
    khoj-assistant 0.1.0 depends on numpy==1.22.4

AtomicNess123 avatar Sep 13 '22 09:09 AtomicNess123

What command are you running to install khoj and which OS are you on? A bit strange that there are multiple, older versions of khoj that it's attempting to install. The recommended way to install khoj is by running pip install --upgrade khoj-assistant. The most recent version of khoj released is 0.1.9

debanjum avatar Sep 13 '22 10:09 debanjum

Thanks for the fast response. I am using the following:

pip install khoj-assistant

AtomicNess123 avatar Sep 13 '22 12:09 AtomicNess123

Could you run pip uninstall khoj-assistant && pip install --no-cache-dir --upgrade khoj-assistant? Just to ensure there's no pip related caching issues we're seeing on your side

On Tue, Sep 13, 2022, 15:15 Name of Mine @.***> wrote:

Thanks for the fast response. I am using the following:

pip install khoj-assistant

— Reply to this email directly, view it on GitHub https://github.com/debanjum/khoj/issues/97#issuecomment-1245328659, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQ5ZJJNPRUMS2NCXPU37ILV6BV7LANCNFSM6AAAAAAQLIVR2U . You are receiving this because you commented.Message ID: @.***>

debanjum avatar Sep 13 '22 12:09 debanjum

Thanks.

I get this:

§ pip uninstall khoj-assistant && pip install --no-cache-dir --upgrade khoj-assistant  127 ✘ 

WARNING: Skipping khoj-assistant as it is not installed.
Collecting khoj-assistant
  Downloading khoj_assistant-0.1.4-py3-none-any.whl (142 kB)
     |████████████████████████████████| 142 kB 216 kB/s 
Requirement already satisfied: pillow>=9.0.1 in ./opt/anaconda3/lib/python3.7/site-packages (from khoj-assistant) (9.0.1)
  Downloading khoj_assistant-0.1.3-py3-none-any.whl (142 kB)
     |████████████████████████████████| 142 kB 393 kB/s 
  Downloading khoj_assistant-0.1.2-py3-none-any.whl (142 kB)
     |████████████████████████████████| 142 kB 594 kB/s 
  Downloading khoj_assistant-0.1.0-py3-none-any.whl (51 kB)
     |████████████████████████████████| 51 kB 307 kB/s 
ERROR: Cannot install khoj-assistant==0.1.0, khoj-assistant==0.1.2, khoj-assistant==0.1.3 and khoj-assistant==0.1.4 because these package versions have conflicting dependencies.

The conflict is caused by:
    khoj-assistant 0.1.4 depends on numpy==1.22.4
    khoj-assistant 0.1.3 depends on numpy==1.22.4
    khoj-assistant 0.1.2 depends on numpy==1.22.4
    khoj-assistant 0.1.0 depends on numpy==1.22.4

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

AtomicNess123 avatar Sep 13 '22 12:09 AtomicNess123

Ah, based on those logs

  1. You're on an older python version (3.7). The newer versions of Khoj need python >= 3.8
  2. You're running an anaconda python. Are you running the pip install command from within a conda environment?

Suggested fixes:

  • You can fix 1. by upgrading the installed version of python on your system/anaconda environment
  • A different version of numpy is already installed than the one required by Khoj. Some ways to solve this are:
    1. Installing Khoj in a separate virtualenv or conda environment.
    2. Checking if it's safe to upgrade/downgrade numpy to 1.22.4 and manually doing that before trying to reinstall Khoj

debanjum avatar Sep 13 '22 17:09 debanjum

Thanks! I did:

git clone https://github.com/debanjum/khoj && cd khoj
conda env create -f config/environment.yml
conda activate khoj

Then I tried to run khoj by typing its name... but nothing happened.

AtomicNess123 avatar Sep 19 '22 16:09 AtomicNess123

I tried to install khoj like this with khoj env active, and got this error:

§ pip install khoj-assistant
Traceback (most recent call last):
  File "/Users/User/opt/anaconda3/envs/khoj/bin/pip", line 6, in <module>
    from pip._internal.cli.main import main
  File "/Users/User/opt/anaconda3/envs/khoj/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 9, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/Users/User/opt/anaconda3/envs/khoj/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/Users/User/opt/anaconda3/envs/khoj/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "/Users/User/opt/anaconda3/envs/khoj/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 13, in <module>
    import importlib.util
  File "/Users/User/opt/anaconda3/lib/python3.7/importlib/__init__.py", line 51, in <module>
    _w_long = _bootstrap_external._w_long
AttributeError: module 'importlib._bootstrap_external' has no attribute '_w_long'

AtomicNess123 avatar Sep 19 '22 17:09 AtomicNess123

   File "/Users/User/opt/anaconda3/envs/khoj/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 13, in <module>
    import importlib.util
  File "/Users/User/opt/anaconda3/lib/python3.7/importlib/__init__.py", line 51, in <module>

From the above error logs there seems to be an issue with your anaconda environment as both python3.7 and python3.8 libraries are being used in it.

Then I tried to run khoj by typing its name... but nothing happened.

The instructions to setup Khoj using (ana-)conda are here. According to that if you can start khoj by running python3 -m src.main -vv after you've setup the khoj conda environment. You shouldn't need to pip install khoj-assistant in the khoj conda environment.

  1. The khoj setup with conda instructions maybe stale as I haven't tested this flow for a while. So let me try the conda environment setup flow on my end to see if I can reproduce your issue. I'll get back about this by the end of this week

debanjum avatar Sep 27 '22 09:09 debanjum