For some time I have been trying to figure out how to handle reading a few different programming books and having other projects. I learned that it would be best through a python virtual environment to manage the package dependencies. However I then needed/wanted to use the same python version. Which I found a version of pyenv for windows, now when I am within the local environments I am still having issues.
I have decided to start using the open source program Anaconda to handle my separate projects and there environments. This also means I should be able to carry them across devices, which I need
However, I am reading Test Driven Development with Python, Obey the testing GOAT! Which uses Selenium and Django, I have them installed however I am still greeted with another Error message:
(django-selenium) C:\Users\Steven Walker\Documents\Projects\Python\tdd-book>python functional_tests.py
Traceback (most recent call last):
File "C:\Users\Steven Walker\Documents\Projects\Python\tdd-book\functional_tests.py", line 2, in <module>
browser = webdriver.Firefox()
File "C:\Users\Steven Walker\.conda\envs\django-selenium\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 170, in __init__
RemoteWebDriver.__init__(
File "C:\Users\Steven Walker\.conda\envs\django-selenium\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__ ......
I'm sure that I have the geckodriver for Firefox installed, as I am able to use geckodriver --version.
I have added the firefox browsers directory to the PATH in environment variables but still no luck. I was wondering if anyone would be able to help me, as i seem to be spending more time dealing with these issues than learning (the material) at the moment. I need the environment to find the browser ideally...
After some further research I found that this was a common issue and someone has wrote a guide for setting up the books requirements within Anaconda. Tdd-ottg using Anaconda
I am currently following it with ease to the point of starting up spyder within the terminal. I will report back my findings.
Edit: 02/09/23: I have django working within anaconda. I am still trying to install the spyder-kernels that the blog post suggested. Specifically having issues with installing the ipykernel to the virtual environment.
i receive the following codeback:
ERROR conda.core.link:_execute(945): An error occurred while installing package 'defaults::ipykernel-4.10.0-py27_0'.
Rolling back transaction: done
LinkError: post-link script failed for package defaults::ipykernel-4.10.0-py27_0
location of failed script: C:\.conda\ottg\Scripts\.ipykernel-post-link.bat
==> script messages <==
<None>
==> script output <==
stdout:
stderr:
return code: 1
Edit:05/09/23
Found an Anaconda user with the same issue with the conda install spyder-kernels due to the ipykernel. After reading this thread I found that someone was able to install it in the virtual environment using pip.
TLDR: {Edit: Note!: Create the new environment in Anaconda using 'conda create --prefix location python=3.6.7' to avoid installing packages in a location with a potential space and the correct python version} then use to install the kernels use pip via: pip install spyder-kernels