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:
- can’t complete install requirements.txt
- not knowning if connection is fine or how to fix it if it’s not
- can’t get jupyter works
#1:
(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.
#2
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\test_db_connection.py EEEE [100%]
======================================================= ERRORS ========================================================
_________________________________________ ERROR at setup of test_atlas_setup __________________________________________
request = <SubRequest ‘_configure_application’ for >
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x0000023F3414C8D0>
@pytest.fixture(autouse=True)
def _configure_application(request, monkeypatch):
"""Use `pytest.mark.options` decorator to pass options to your application
factory::
@pytest.mark.options(debug=False)
def test_something(app):
assert not app.debug, 'the application works not in debug mode!'
"""
if 'app' not in request.fixturenames:
return
app = request.getfuncargvalue('app')
E _pytest.warning_types.RemovedInPytest4Warning: getfuncargvalue is deprecated, use getfixturevalue
C:\Anaconda3\envs\mongotest\lib\site-packages\pytest_flask\plugin.py:109: RemovedInPytest4Warning
_________________________________________ ERROR at setup of test_basic_movies _________________________________________
and follows by bunck of errors… what does that mean?
#3
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\runpy.py”, line 193, in run_module_as_main
“main”, mod_spec)
File “c:\anaconda3\envs\mongotest\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File “c:\anaconda3\envs\mongotest\lib\site-packages\ipykernel_launcher.py”, 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\connect.py”, 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\embed.py”, line 16, in
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File “c:\anaconda3\envs\mongotest\lib\site-packages\IPython\terminal\interactiveshell.py”, 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