See previous inputs in Scrapy Shell? - terminal

So in the regular python terminal you can push the up arrow to see what you have previously entered into the terminal and I was wondering if there was an equivalent to this in the scrapy shell?
Edit
I am using the Pycharm Terminal if that helps

Installing https://pypi.org/project/pyreadline/ solved that problem. Seems like is a problem with readline.
pip install pyreadline
Edit: Or you can just use PowerShell, go to your project directory then shift+right click, open PowerShell then .\venv\Scripts\activate to activate your venv and finally scrapy shell.

Related

How to PATH pip from Spyder(anaconda3) to use in windows 10 command prompt

I use Spyder(anaconda3) to do much of my python work and I can use pip install directly from the spider console but not from windows 10 command prompt. Is there a way to PATH pip install from the spider/anaconda program to work directly with the command prompt?
Is this something that is strictly necessary or even useful to do, can the spider console handle all that is required (even non python instilations) without bothering with the windows comand prompt? For example if I were to run
pip install jupyterlab
from the spider console would this be an issue or would it make more sense to run it from the command prompt? (I know jupyterlab is included in annaconda I was just looking for an exapmle)
The only difference between running the Windows command shell from Spyder is that Spyder will automatically activate your conda environment. You can achive the same thing by running
conda activate
as the first command in your Windows cmd shell.
Alternatively you can start the cmd shell via the "Anaconda prompt" in the Windows Start Menu.

ModuleNotFoundError: No Module Named 'requests' VSCODE Mac OS

I am having a problem running my script in VSCode.
I have tried the following:
Reinstalling requests through pip, easy_install, and sudo pip
Importing requests directly in the Python interpreter (which worked)
This leads me to believe that VSCode isn't using the correct interpreter that actually has the package installed.
You can choose your interpreter in VS Code in several ways. One of them is by clicking the tab in the bottom toolbar (lower-left) which might say "Python 3.9.4 (64-bit)", upon which you will be able to select from a menu of choices, e.g. /usr/bin/python3 or a conda or brew installation, etc.
I think yours is python environment problem. To check whether it's python environment or not, you can use which python (or which python3 if you use python3) command in your both vscode terminal and mac terminal. If you see different python path, then your vscode is using different python environment. You can change the python interpreter in vscode to have same environment as your mac terminal.
Open Command Palette in vscode with ⇧⌘P
Type "Python: Select Interpreter"
Then, choose the same environment as your mac terminal (If you want the same one, you can choose the same python environment path as mac terminal that you get with "which python" or "which python3").
You may be able to find a solution here: ImportError: No module named requests
You haven't mentioned using different versions in your commands. It's possible you need to use pip3 instead of pip, or python3 instead of python.

Pipenv installed, but "doesn't exist"

i'm trying to install pipenv on Windows 10 to use it with Docker, i've done the following steps on my Command Line:
pip install pipenv
(output)
pipenv
output (translation: "pipenv" is not recognized as an internal or external command, operable program or batch file)
So Windows tells me pipenv is not installed. How is it possible? How i can fix this? Thank you
The first thing you should do is add python to the window system variable. If you haven't done that, follow these steps:
Type "variable" to the search bar and select "Edit the system variable".
Click on the "environment variable..." button and you should see the list of variables that has been added by window.
Select the one containing the word "path" and click "edit".
Click the new and you can add the path to which you installed python.
For example:
My python is at
c:\python
Copy that and put into the edit box and click OK.
Lastly, click OK again and you should be good to go.
After you did that, you can do this to your command line:
python pipenv
Note: make sure you have pipenv installed by pip.
I had this same problem. Tried everything that has been recommended here and elsewhere.
Verified that Pip was in path
Python39 runs fine
PyCharm runs fine.
Finally, right clicked on Python in my list of programs in Windows10 and selected modify
Checked the various boxes during the modify dialog.
Pip now loads and works fine.

ModuleNotFoundError Despite Installing with pip

mac os Catalina, python3.8.2
Hey All,
I know there are similar questions about this, but they didn't seem to help me. I installed a module (quandl) using pip3.8 install. Then I try to import quandl in a .py file and get a ModuleNotFoundError. I do have multiple versions of python installed, can't figure out how to get rid of them safely, hence why I used pip3.8 install to make sure it points to the write place. Still no dice. I am not using a venv.
From the terminal, this is the pip3.8 install path: /usr/local/lib/python3.8/site-packages
From the .py file via VScode, I am interpreting using: /usr/local/bin/python3.8
Can someone educate me on what I am doing wrong?
I was previously interpreting from /Library/Frameworks/Python.framework/Versions/3.8/bin/python3, but I noticed pip was not installing there.
At the bottom of your VSCode window, there's an orange status bar. Starting at the far left, you'll see your git repo info, the git status, and then the Python environment you're using. If you click that, VSCode will slide in a modal dialog window that'll let you choose your python environment -- my VSCode defaulted to /usr/bin/python3, but my pip3 (and python3) are in /usr/local/bin. Once I picked the correct interpreter, I stopped getting the ModuleNotFoundError

How to open a Jupyter notebook on a Mac?

Maybe this does not work at all, because its a Mac, but maybe there is a way to open a jupyter notebook on a Mac? I tried the following command
jupyter notebook Manager.ipynb
and I got an error
Error executing Jupyter command 'notebook': [Errno 2] No such file or directory. Same with out 'notebook':
jupyter Manager.ipynb
Error executing Jupyter command 'Manager.ipynb': [Errno 2] No such file or directory
There is a file named Manager.ipynb in the current folder.
So is there a way to open that notebook on a Mac? Do I have to install some crazy stuff in order to make it work?
The problem I was facing was either a mis-installation of jupyter, or there is another application on Macs with the same name. However, (re)install it with this command
pip install --user jupyter
(a global pip install does not seem to work because of some Mac-nonsense, see here), and then it might work. Or install it in a virtual environment altogether.
This may or may not be helpful for you, but it's something to know and it's how I access the notebook on my mac.
When I installed Julia, it just came with the command line, I never got the icon to open the notebook or anything of that nature. I had too much trouble trying to install it so I just gave up on getting the icon or a direct link, but if you get Julia installed, you should be able to access the terminal version by entering
$ Julia
Or clicking on the Julia terminal icon, which will give you this:
And then you can just open the notebook by running the following:
using IJulia
IJulia.notebook()
Also if you're just starting with Julia don't forget you may have to add the package manager by typing using Pkg or adding it directly to your code.
This should open it in your default browser (there is no option to open it in a different browser or window). I'm not sure if this is useful but it's an option for those who have trouble installing it like I did.

Resources