Question of building python env and test

I’m new to python. I’m trying to follow the steps in Chapter 1 to get all gear up and run but it wasn’t so lucky at all.

Got three issues:

  1. can’t complete install requirements.txt
  2. not knowning if connection is fine or how to fix it if it’s not
  3. can’t get jupyter works

(I’m not sure about that if my way made sense all because your descriptions is too simple for a newbi)
After installed anaconda, I try to use the command: conda install --file=requirements.txt, and it shows:
PackagesNotFoundError: The following packages are not available from current channels:

  • jupyter-console==5.2.0
  • flask-jwt-extended==3.7.0
  • jupyter-client==5.2.3
  • jupyter-core==4.4.0
  • pytest-flask==0.10.0
  • flask==0.12.4
  • flask-bcrypt==0.7.1

looks like anaconda doesn’t have them. Then I tried to use:

pip install -r requirements.txt
most of them were looked like be installing until I saw the message in red says:
ipython 7.2.0 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you’ll have prompt-toolkit 1.0.15 which is incompatible.

I don’t know if it’s important issue or something, anyhowI try the next (so far I modified connection SRV in .ini):

pytest -m test_db_connection
and got:
================================================= test session starts =================================================
platform win32 – Python 3.7.2, pytest-4.2.0, py-1.7.0, pluggy-0.8.1
rootdir: C:\MongoDB\m220p\mflix-python, inifile:
plugins: flask-0.10.0
collected 43 items / 39 deselected / 4 selected

tests\ EEEE [100%]

======================================================= ERRORS ========================================================
_________________________________________ ERROR at setup of test_atlas_setup __________________________________________

request = <SubRequest ‘_configure_application’ for >
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x0000023F3414C8D0>

def _configure_application(request, monkeypatch):
    """Use `pytest.mark.options` decorator to pass options to your application

        def test_something(app):
            assert not app.debug, 'the application works not in debug mode!'

    if 'app' not in request.fixturenames:
  app = request.getfuncargvalue('app')

E _pytest.warning_types.RemovedInPytest4Warning: getfuncargvalue is deprecated, use getfixturevalue

C:\Anaconda3\envs\mongotest\lib\site-packages\pytest_flask\ RemovedInPytest4Warning
_________________________________________ ERROR at setup of test_basic_movies _________________________________________

and follows by bunck of errors… what does that mean?

I started jupyter notebook, clicked to MongoClient.ipynb, tried to execute the lines. But got no result returned to the cell of each line as it should be. Like when I run the line “from pymongo import MongoClient” and uri = “{mongo srv string}”
I saw the console shows as the following (to me it looks like related to the installation error in #1):
File “c:\anaconda3\envs\mongotest\lib\”, line 193, in run_module_as_main
main”, mod_spec)
File “c:\anaconda3\envs\mongotest\lib\”, line 85, in run_code
exec(code, run_globals)
File “c:\anaconda3\envs\mongotest\lib\site-packages\”, line 15, in
from ipykernel import kernelapp as app
File "c:\anaconda3\envs\mongotest\lib\site-packages\ipykernel_init
.py", line 2, in
from .connect import *
File “c:\anaconda3\envs\mongotest\lib\site-packages\ipykernel\”, line 13, in
from IPython.core.profiledir import ProfileDir
File "c:\anaconda3\envs\mongotest\lib\site-packages\IPython_init
.py", line 55, in
from .terminal.embed import embed
File “c:\anaconda3\envs\mongotest\lib\site-packages\IPython\terminal\”, line 16, in
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File “c:\anaconda3\envs\mongotest\lib\site-packages\IPython\terminal\”, line 20, in
from prompt_toolkit.formatted_text import PygmentsTokens
ModuleNotFoundError: No module named ‘prompt_toolkit.formatted_text’
[I 15:57:21.029 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports

When copy/pasting blocks of code, commands, configuration or logging, please select the whole text and then press the </> button to make it a codeblock. Right now your post is not very legible. It’s hard to make out how things are.

Is it what you’re sayign?

Just reinstall it n times, I do the install requirements.txt by conda this time (the README.rst use pip only)

Thanks for a guy’s post, I use the cmd prompt (windows)

$ FOR /F “delims=~” %f in (requirements.txt) DO conda install --yes “%f” || pip install “%f”

It can install the package one by one. However, when I execute, the error says can’t found module flask-Bcrypt. So I go to anaconda and find the following result:

I don’t see it supports windows platform. Is it the dead end?

just tried build on centos 7.5 with virtualenv, when updating the requirements.txt, I got another message in red:

ipython 7.3.0 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.15 which is incompatible.

I don’t understand is it just me? or everybody else is using macOS ?

Hi there,

Could you please tell us which version of windows you are running when you hit the flask-Bcrypt issue?