importlib.metadata.PackageNotFoundError: bitsandbytes
Author: looperEit
Pull request: no

### System Info

 `transformers` version: 4.32.0.dev0
- Platform: Linux-5.4.0-153-generic-x86_64-with-glibc2.27
- Python version: 3.9.17
- Huggingface_hub version: 0.16.4
- Safetensors version: 0.3.1
- Accelerate version: 0.21.0
- Accelerate config:    not found
- PyTorch version (GPU?): 2.0.1+cu117 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>


### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig, AutoModel
from transformers import BitsAndBytesConfig
from transformers.generation.utils import GenerationConfig
import torch.nn as nn

model_name_or_path = "Baichuan-13B-Chat"

bnb_config = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.float16, bnb_4bit_use_double_quant=True, bnb_4bit_quant_type="nf4", llm_int8_threshold=6.0, llm_int8_has_fp16_weight=False)

tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=False, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_name_or_path, trust_remote_code=True)
model.generation_config = GenerationConfig.from_pretrained(model_name_or_path)

messages = []
messages.append({"role": "user", "content": "世界上第二高的山峰是哪座"})
response = model.chat(tokenizer, messages)
print(response)


### Expected behavior

`import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig, AutoModel
from transformers import BitsAndBytesConfig
from transformers.generation.utils import GenerationConfig
import torch.nn as nn

model_name_or_path = "Baichuan-13B-Chat"

bnb_config = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.float16, bnb_4bit_use_double_quant=True, bnb_4bit_quant_type="nf4", llm_int8_threshold=6.0, llm_int8_has_fp16_weight=False)

tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=False, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_name_or_path, trust_remote_code=True)
model.generation_config = GenerationConfig.from_pretrained(model_name_or_path)

messages = []
messages.append({"role": "user", "content": "世界上第二高的山峰是哪座"})
response = model.chat(tokenizer, messages)
print(response)
`
I reported an error after importing BitsAndBytesConfig from transformer：
![image](https://github.com/huggingface/transformers/assets/46367388/c0aefd1b-3e7d-45d3-949e-53b8dc407d6c)
But after I installed bitsandbytes, I still reported an error:
![image](https://github.com/huggingface/transformers/assets/46367388/2fd1629b-0b26-4fb7-b6d1-6ddc9a86f4b0)


Comments:
Hi @looperEit, thanks for reporting this issue! 

Could you share the installed version of bitsandbytes and how you installed it? 

cc @younesbelkada 

i used the `pip install -r *requriment.txt"`,and the txt file like:
![image](https://github.com/huggingface/transformers/assets/46367388/e6bb0a94-6a32-48f2-8a1b-551da63fbc54)

accelerate
colorama~=0.4.6
cpm_kernels
sentencepiece~=0.1.99
streamlit~=1.25.0
transformers_stream_generator
torch~=2.0.1
transformers~=4.31.0

Hi @looperEit 
Can you try to run
```bash
pip install bitsandbytes
```
it looks like this is missing in `requirements.txt` file

> Hi @looperEit Can you try to run
> 
> ```shell
> pip install bitsandbytes
> ```
> 
> it looks like this is missing in `requirements.txt` file
when i installed the bitsandbytes, it shows：
![image](https://github.com/huggingface/transformers/assets/46367388/6afcb6fd-17d3-4c27-aaef-46d7fe1b0cc4)
may i join it in my `requirements.txt` file？

@looperEit Yes, you can certainly add it to your own requirements.txt file. 

For the error being raised, could you copy paste the full text of the traceback, rather than a screenshot? This makes it easier for us to debug, as we highlight and copy the text, and also makes the issue findable through search for anyone else who's had the issue. 

In the screenshot for the error after installing bitsandbytes, could you show the full trackback? The final error message / exception appears to be missing. 

i'm so sorry QAQ ,here is the problem when i installed the bitsandbytes:
`/root/anaconda3/envs/baichuan/bin/python3.9 /tmp/Baichuan-13B/ demo. pyTraceback (most recent call last):
File "/root/anacondaS/envs/baichuan/1io/pythons.9/site-packages/transfonmens/utils/import_utils.py"，line 1099，in _get_modulereturn importlib.import_module("." + module_name,self.__name_-)
File "/root/anaconda3/envs/baichuan/lib/python3.9/impontlib/.-init...py"，line 127,in impont_ modulereturn _bootstrap. _gcd_import(name[level:], package,level)
File "<frozen importlib._bootstrap>",line 1030,in _gcd_importFile "<frozen importlib._bootstrap>",line 1007，in _find_and_load
File "<frozen importlib._bootstrap>",line 986, in _find_and_load_unlockedFile "<frozen importlib._bootstrap>",line 680, in _load_unlocked
File "<frozen importlib._bootstrap_externals", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228，in _call_with_frames_removed`
but finally when i installed the `spicy`,  i make it. i didn't know why. Maybe the transfomer package and bitsandbytes must coexist with spicy?

maybe 🤷‍♀️ although the package manager should have installed any dependencies alongside the library itself. Do you mean `scipy` for the dependency? I've never heard of spicy. 

Either way, I'm glad to hear that you were able to resolve the issue :) Managing python environments is a perpetual juggling act. 

> maybe 🤷‍♀️ although the package manager should have installed any dependencies alongside the library itself. Do you mean `scipy` for the dependency? I've never heard of spicy.
> 
> Either way, I'm glad to hear that you were able to resolve the issue :) Managing python environments is a perpetual juggling act.

i'm so sorry，I know where the problem is. The model requirement I use does not include the scipy package. I'm really sorry for wasting your time and disturbing you. Thanks.
![image](https://github.com/huggingface/transformers/assets/46367388/8efb350c-f328-4591-be0a-781122f27f5b)


`pip install bitsandbytes ` works for me.

`pip install bitsandbytes` really works for me. But the bitsandbytes library only works on CUDA GPU. What a pity! I want to use it on Intel cpu.

> Hi @looperEit Can you try to run
> 
> ```shell
> pip install bitsandbytes
> ```
> 
> it looks like this is missing in `requirements.txt` file

Nice, thank you bro

> ```shell
> pip install bitsandbytes
> ```

Thanks! works for me