# How can I build jupyter source code to wheel?

**URL:** <https://discourse.jupyter.org/t/how-can-i-build-jupyter-source-code-to-wheel/27608>\
**Category:** Notebook\
**Created:** [August 15, 2024, 8:43am UTC](https://discourse.jupyter.org/t/how-can-i-build-jupyter-source-code-to-wheel/27608 "2024-08-15T08:43:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnysh](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/johnysh/32/12047_2.png) [@johnysh](https://discourse.jupyter.org/u/johnysh)\
**Post date:** [August 15, 2024, 8:43am UTC](https://discourse.jupyter.org/t/how-can-i-build-jupyter-source-code-to-wheel/27608/1 "2024-08-15T08:43:17Z")

</div>

When I git clone source code from [GitHub - jupyter/notebook: Jupyter Interactive Notebook](https://github.com/jupyter/notebook.git),  
and I followed these steps to build 🙂  
(1) conda env update --file binder/environment.yml  
(2) conda activate notebook  
(3) pip install -ve .  
(4) jlpm run build  
but when I ran “python setup.py build” or “python setup.py sdist” , it met errors:

(notebook) intel@intel:~/notebook$ python setup.py build

error: Multiple top-level packages discovered in a flat-layout: [‘app’, ‘binder’, ‘packages’, ‘notebook’, ‘buildutils’, ‘node\_modules’].

To avoid accidental inclusion of unwanted files or directories,

setuptools will not proceed with this build.

If you are trying to create a single distribution with multiple packages

on purpose, you should not rely on automatic discovery.

Instead, consider the following options:

1. set up custom discovery (`find` directive with `include` or `exclude`)

2. use a `src-layout`

3. explicitly set `py_modules` or `packages` with a list of names

To find more information, look for “package discovery” on setuptools docs.

Who can kindly help me? @ [  
krassowski  
 ](https://discourse.jupyter.org/chat/c/krassowski/52/info/settings) @ [trungleduc](https://discourse.jupyter.org/u/trungleduc)

---

<div class="post-metadata">

**Author:** ![krassowski](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/krassowski/32/1685_2.png) [@krassowski](https://discourse.jupyter.org/u/krassowski)\
**Post date:** [August 15, 2024, 9:06am UTC](https://discourse.jupyter.org/t/how-can-i-build-jupyter-source-code-to-wheel/27608/2 "2024-08-15T09:06:32Z")

</div>

Instead of `python setup.py build` try:

```auto
conda install build hatch
python -m build

```

---

<div class="post-metadata">

**Author:** ![johnysh](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/johnysh/32/12047_2.png) [@johnysh](https://discourse.jupyter.org/u/johnysh)\
**Post date:** [August 15, 2024, 9:29am UTC](https://discourse.jupyter.org/t/how-can-i-build-jupyter-source-code-to-wheel/27608/3 "2024-08-15T09:29:08Z")

</div>

Thank you @krassowski .I did it and it was success. I have another question maybe you can give me some help. If I modify some codes, do I need to re-run " jlpm run build" ? If miss this step and directly generate wheel , will the generated wheel contain the modified code and take effect?

---

<div class="post-metadata">

**Author:** ![fcollonval](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fcollonval/32/801_2.png) [@fcollonval](https://discourse.jupyter.org/u/fcollonval)\
**Post date:** [August 19, 2024, 6:51pm UTC](https://discourse.jupyter.org/t/how-can-i-build-jupyter-source-code-to-wheel/27608/4 "2024-08-19T18:51:32Z")

</div>

It is unlikely that you got the latest code version one the wheel.

By default, we recommend cleaning the code directory before building the wheel to ensure it will rebuild the JavaScript files for the latest version.

You can clean the code using `jlpm run clean:all` or if you want to reset the git repository using `git clean -dfx` (be careful with the latter as it will delete all unversioned files).
