# My first contribution

**URL:** <https://forum.djangoproject.com/t/my-first-contribution/12513>\
**Category:** Mentorship\
**Created:** [March 8, 2022, 10:41pm UTC](https://forum.djangoproject.com/t/my-first-contribution/12513 "2022-03-08T22:41:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mam](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mam/32/7733_2.png) [@mam](https://forum.djangoproject.com/u/mam)\
**Post date:** [March 8, 2022, 10:41pm UTC](https://forum.djangoproject.com/t/my-first-contribution/12513/1 "2022-03-08T22:41:42Z")

</div>

Hi,  
I choose from tickets this [one](https://code.djangoproject.com/ticket/33256) but I can’t reproduce the error,  
I studied [run tests](https://docs.djangoproject.com/en/4.0/internals/contributing/writing-code/unit-tests/#quickstart) but it make another error:  
Traceback (most recent call last):  
File “./runtests.py”, line 16, in   
import django  
File “/usr/local/lib/python3.8/dist-packages/django/ **init**.py”, line 1, in   
from django.utils.version import get\_version  
ModuleNotFoundError: No module named ‘django.utils’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):  
File “./runtests.py”, line 18, in   
raise RuntimeError(  
RuntimeError: Django module not found, reference tests/README.rst for instructions.  
Error in sys.excepthook:  
Traceback (most recent call last):  
File “/usr/lib/python3/dist-packages/apport\_python\_hook.py”, line 72, in apport\_excepthook  
from apport.fileutils import likely\_packaged, get\_recent\_crashes  
File “/usr/lib/python3/dist-packages/apport/ **init**.py”, line 5, in   
from apport.report import Report  
File “/usr/lib/python3/dist-packages/apport/report.py”, line 32, in   
import apport.fileutils  
File “/usr/lib/python3/dist-packages/apport/fileutils.py”, line 12, in   
import os, glob, subprocess, os.path, time, pwd, sys, requests\_unixsocket  
File “/usr/lib/python3/dist-packages/requests\_unixsocket/ **init**.py”, line 4, in   
from .adapters import UnixAdapter  
File “/usr/lib/python3/dist-packages/requests\_unixsocket/adapters.py”, line 3, in   
from requests.adapters import HTTPAdapter  
ModuleNotFoundError: No module named ‘requests.adapters’

Original exception was:  
Traceback (most recent call last):  
File “./runtests.py”, line 16, in   
import django  
File “/usr/local/lib/python3.8/dist-packages/django/ **init**.py”, line 1, in   
from django.utils.version import get\_version  
ModuleNotFoundError: No module named ‘django.utils’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):  
File “./runtests.py”, line 18, in   
raise RuntimeError(  
RuntimeError: Django module not found, reference tests/README.rst for instructions.

I didn’t see any other instruction to run test in documentation.  
Thanks.

---

<div class="post-metadata">

**Author:** ![carltongibson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/carltongibson/32/267_2.png) [@carltongibson](https://forum.djangoproject.com/u/carltongibson)\
**Post date:** [March 9, 2022, 8:12am UTC](https://forum.djangoproject.com/t/my-first-contribution/12513/2 "2022-03-09T08:12:42Z")

</div>

Hi @mam — It looks like (?) you haven’t set up you’re virtual environment properly.

Have a look at this part of the Contributing Guide, which had a good walk-through on running the test suite: [Unit Tests | Django Documentation | Django](https://docs.djangoproject.com/en/4.0/internals/contributing/writing-code/unit-tests/)

---

<div class="post-metadata">

**Author:** ![mam](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mam/32/7733_2.png) [@mam](https://forum.djangoproject.com/u/mam)\
**Post date:** [March 9, 2022, 11:07am UTC](https://forum.djangoproject.com/t/my-first-contribution/12513/3 "2022-03-09T11:07:50Z")

</div>

I do exactly the same as mentioned in [docs](https://docs.djangoproject.com/en/4.0/internals/contributing/writing-code/unit-tests/)

$ git clone [https://github.com/YourGitHubName/django.git](https://github.com/YourGitHubName/django.git) django-repo  
$ cd django-repo/tests  
$ python -m pip install -e …  
$ python -m pip install -r requirements/py3.txt  
$ ./runtests.py

---

<div class="post-metadata">

**Author:** ![carltongibson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/carltongibson/32/267_2.png) [@carltongibson](https://forum.djangoproject.com/u/carltongibson)\
**Post date:** [March 9, 2022, 2:06pm UTC](https://forum.djangoproject.com/t/my-first-contribution/12513/4 "2022-03-09T14:06:34Z")

</div>

OK, but…

> [@mam](#):
>
> File “./runtests.py”, line 16, in  
> import django  
> File “/usr/local/lib/python3.8/dist-packages/django/ **init**.py”, line 1, in  
> from django.utils.version import get\_version  
> ModuleNotFoundError: No module named ‘django.utils’

All I can suggest is open a REPL, and see if you can import `django`:

```auto
% python
Python 3.10.2 (v3.10.2:a58ebcc701, Jan 13 2022, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(4, 1, 0, 'alpha', 0)

```

> [@mam](#):
>
> $ python -m pip install -e …

Check this is right. If you’re in the `tests` dir `..` will give you the repo root (you’ve put `...` — three dots there…?)

---

<div class="post-metadata">

**Author:** ![mam](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mam/32/7733_2.png) [@mam](https://forum.djangoproject.com/u/mam)\
**Post date:** [March 9, 2022, 4:15pm UTC](https://forum.djangoproject.com/t/my-first-contribution/12513/5 "2022-03-09T16:15:57Z")

</div>

Thank you @carltongibson  
I check your command and works exactly fine.  
I check it in other directories and see that Django is installed in my machine and It doesn’t installed correctly so the error was for that So I build a fresh python environment to test it.

No, it’s `..`
