#πŸ”’ making website with mkdocs some issue

189 messages Β· Page 1 of 1 (latest)

fleet belfry
atomic skyBOT
#

@fleet belfry

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

fleet belfry
#

@oblique trout

oblique trout
#

hey

fleet belfry
#

hi

oblique trout
#

py -m pip list

#

share the result

fleet belfry
oblique trout
#

ill just finish some conversations going on in paralell

#

i see mkdocs is there, that is good.. now, explain what problem you are trying to solve here? because i want to give you the correct answer to your issue

fleet belfry
#
mkdocs : The term 'mkdocs' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a 
path was included, verify that the path is correct and try again.
At line:1 char:1
+ mkdocs serve
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (mkdocs:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
#

i typed this on terminal and it gives this weird error

#

i was following this website to make website

oblique trout
#

i know what your issue is and dhow to solve it, but i need to know what you are going to use mkdocs for

fleet belfry
#

i want to make a website like nedbat made but with markdown maybe

#

like blogs and cool stuff

oblique trout
#

i see... that is a great thing to do.. so you want to use it for a project

#

but you installed it globally

#

thats not something you should do with python projects

fleet belfry
#

yeah kinda making a website for blogs and stuff ig u can call it a project

oblique trout
#

you should install it in a virtual enviorment

fleet belfry
oblique trout
#

there are ofc ways to make python tools work globally, but this is not a tool you need globally

fleet belfry
#

isnt terminal a venv?

oblique trout
#

nope

fleet belfry
#

ohh

oblique trout
#

a terminal is the program you use to run your shell

#

want me to help you with this?

fleet belfry
#

yes

#

if its possible

oblique trout
#

do you have all your projects in a your own dev folder?

fleet belfry
#

yes i do

oblique trout
#

mine is dev

fleet belfry
#
python essentials/
β”œβ”€β”€ coding-journal-2025/
β”‚  β”œβ”€β”€python_notes
β”‚  └──small python projects 
└── discord/
oblique trout
#

so go in that folder and create a new folder for your website project

fleet belfry
#

yep made

oblique trout
#

and inside this folder we will make a venv

fleet belfry
oblique trout
#

do make one you need to run the venv module with a folder name, convention makes us call this folder .venv

#

py -m venv .venv

#

thats how you do it on windows

#

i dont have py on linux, so i have to manage my versions differntly

fleet belfry
oblique trout
#

alright.. never touch the .venv folder

fleet belfry
#

ok

oblique trout
#

it is not meant to be human changable (some exclusion apply) and it is not portable, you cant move it

#

thats why it stays in the project folder

#

now with the venv created, you have to activate it

#

!venv

atomic skyBOT
#
Virtual environments

Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements.

To create a new virtual environment, you can use the standard library venv module: python3 -m venv .venv (replace python3 with python or py on Windows)

Then, to activate the new virtual environment:

Windows (PowerShell): .venv\Scripts\Activate.ps1
or (Command Prompt): .venv\Scripts\activate.bat
MacOS / Linux (Bash): source .venv/bin/activate

Packages can then be installed to the virtual environment using pip, as normal.

For more information, take a read of the documentation. If you run code through your editor, check its documentation on how to make it use your virtual environment. For example, see the VSCode or PyCharm docs.

Tools such as poetry and pipenv can manage the creation of virtual environments as well as project dependencies, making packaging and installing your project easier.

Note: When using PowerShell in Windows, you may need to change the execution policy first. This is only required once per user:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
oblique trout
#

.venv\Scripts\Activate.ps1

#

this is windows

#

once activated you will see that it is active in your shell

fleet belfry
#
PS C:\Users\hp\Desktop\White room\Python\python essentials\my-project> .venv\Scripts\Activate.ps1
.venv\Scripts\Activate.ps1 : File C:\Users\hp\Desktop\White room\Python\python essentials\my-project\.venv\Scripts\Activate.ps1 cannot be loaded because 
running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .venv\Scripts\Activate.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

throws an error

oblique trout
#

yes,. one time pr machine

#

pr windows install i should say

#

run that command

fleet belfry
oblique trout
#

i know.. run the comand i posted

#

and then you run the activation again

fleet belfry
#

(.venv) PS C:\Users\hp\Desktop\White room\Python\python essentials\my-project>
ok it worked ig

oblique trout
#

great.. you see that it is active due to the (.venv) name in your path

#

pip list

#

with an active venv, python commands just work

#

run and share

fleet belfry
#
------- -------
pip     25.3
oblique trout
#

py -m pip list also works

#

now, a venv is isolated, so you have to install the packages you want inside the venv

#

that means you have to install mkdoc again inside this venv

fleet belfry
#

ohh

oblique trout
#

you can do that now, and do pip list to see it once it is done

#

and when it is installed, mkdoc as a command will work

#

hows it going @fleet belfry ?

fleet belfry
#

umm idk how to open venv to install is it near somewhere of terminal

oblique trout
#

what are you wondering about now?

#

you already made it

fleet belfry
#

nah like i have to install mkdocs on it but idk where to do that like is that a window

#

my bad πŸ˜…

oblique trout
#

pip install mkdocs

fleet belfry
#

on terminal?

oblique trout
#

and you also had a few extensions

oblique trout
#

in your active venv

#

you just continue where you where at, everything you do here is in the terminal

fleet belfry
#
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: mkdocs in c:\users\hp\appdata\roaming\python\python314\site-packages (1.6.1)
Requirement already satisfied: mkdocs-material in c:\users\hp\appdata\roaming\python\python314\site-packages (9.7.1)
ERROR: Could not find a version that satisfies the requirement mkodocs-material-extensions (from versions: none)
ERROR: No matching distribution found for mkodocs-material-extensions
#

ig extensions have issue

oblique trout
#

so where did i loose you?

#

because you did something else now

fleet belfry
#

if i quit powershell do i activate venv again?

oblique trout
#

yes

#

ofc

fleet belfry
#

maybe tghat was the issue

oblique trout
#

i did not tell you to close powershell

fleet belfry
#

πŸ˜…

oblique trout
#

so do you want me to help you with this?

#

open your terminal

#

use powershell

fleet belfry
#
.venv\Scripts\Activate.ps1 : The module '.venv' could not be loaded. For more information, run 'Import-Module .venv'.
At line:1 char:1
+ .venv\Scripts\Activate.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (.venv\Scripts\Activate.ps1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoLoadModule

yes i tried activating again

oblique trout
#

go to the project folder from above

oblique trout
#

ls to see

fleet belfry
#

aaah ic

oblique trout
#

when you are in your project folderr

#

activate the venv

#

let me know when this is done

fleet belfry
#

done

#

activated

oblique trout
#

now, run pip install

#

pip install mkdocs mkdocs-material mkdocs-material-extensions

#

pip works on its own here, because your venv is active

#

you could also use py -m pip install mkdocs mkdocs-material mkdocs-material-extensions and it would still work

#

you need to be carefull with windows, because windows is silly when it comes to working with PATHs

fleet belfry
#
Collecting mkdocs-material-extensions
  Using cached mkdocs_material_extensions-1.3.1-py3-none-any.whl.metadata (6.9 kB)
Using cached mkdocs_material_extensions-1.3.1-py3-none-any.whl (8.7 kB)
Installing collected packages: mkdocs-material-extensions
Successfully installed mkdocs-material-extensions-1.3.1

done ig

oblique trout
#

now, share your folder structure from your project

fleet belfry
oblique trout
#

.venv you can hide

#

so inside my-project you have a mkdocs.yml file?

fleet belfry
#

yea i opened it show the whole structure βœ…

oblique trout
#

mkdocs serve will work from that folder

fleet belfry
oblique trout
#

you got this working?

fleet belfry
#
mkdocs : The term 'mkdocs' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, 
verify that the path is correct and try again.
At line:1 char:1
+ mkdocs serve
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (mkdocs:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

i m sorry do i do something wrong

oblique trout
#

show me a screenshot of you installing mkdocs with pip

#

pip list after that as well

fleet belfry
oblique trout
#

now pip list

#

remember windows is silly when it comes to PATHs

fleet belfry
fleet belfry
oblique trout
#

echo $env:PATH

fleet belfry
#

do i type this on terminal

oblique trout
#

yes

fleet belfry
#
C:\Users\hp\Desktop\White room\Python\python essentials\my-project\.venv\Scripts;C:\Program Files\Python314\Scripts\;C:\Program Files\Python314\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Program Files (x86)\Bitvise SSH Client;C:\Espressif;C:\Espressif\tools;D:\Git\cmd;C:\Users\hp\AppData\Local\Microsoft\WindowsApps;;C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\bin;c:\Users\hp\.vscode\extensions\ms-python.debugpy-2025.18.0-win32-x64\bundled\scripts\noConfigScripts
oblique trout
#

from your project folder do ls .venv\Scripts

#

and share

fleet belfry
oblique trout
#

where.exe mkdocs

fleet belfry
#
C:\Users\hp\Desktop\White room\Python\python essentials\my-project\.venv\Scripts\mkdocs.exe
oblique trout
#

i can see mkdocs in your scripts folder.. so i see it is there

#

mkdocs -h

#

run this and see

fleet belfry
#

ic

oblique trout
#

are you juggeling multiple shells?

#

mkdocs serve should now work

#

just go to the folder where your yml file is

fleet belfry
#
INFO    -  Building documentation...
INFO    -  Cleaning site directory
INFO    -  Documentation built in 0.62 seconds
INFO    -  [22:34:59] Serving on http://127.0.0.1:8000/
#

it worked thanks for the patience mhan

fleet belfry
#

i do not know honestly

oblique trout
#

you might want to ask me later for a full developer setup of your terminal

fleet belfry
#

i just activated venv and followed

#

is juggeling like changing shells

#

idk only power shell open ig

oblique trout
#

yeah... i thought maybe you had one here and oone there and one in windows terminal

#

i can look at markdwon in my terminal

fleet belfry
#

hmm

#

thanks mhan

#

❀️

oblique trout
#

and i use a python tool installed globally to do so... ill show you later

#

just remind me about it!

#

its a good segway for applications you want to have in a venv (mkdocs) and other applications you want to have globally

fleet belfry
#

ic

#

hmm btw did i show u this blackjack smol project i made hehe

oblique trout
#

im heading out, but i can show you more tricks later! πŸ˜„

fleet belfry
#

ok bye then

oblique trout
#

i saw it mid way, you can share more later!

#

remember that you have to activate the venv to use mkdoc in your project

fleet belfry
#

πŸ‘

oblique trout
#

deactivate does the opposite

#

you can also close the window

#

alright... catch you later!!

fleet belfry
#

yeah i would close it XD

#

bye

atomic skyBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.