No module named 'xlsxwriter' - installation

I'm trying to install xlsxwriter. I'm using VS Code. I installed two different versions of python when I set this up. When I use 'pip install xlsxwriter' it says it's successfully installed, but when I run the code it brings back the above error. (No module named 'xlsxwriter') I'm using 'import xlsxwriter'.
I've tried uninstalling it, installing wheel, and then trying to install it again, but I'm getting the same error.
How do I make sure I'm installing xlsxwriter correctly?
thank you!

I've been able to get the file to run by typing, 'python3 (file name)' but is there a way to change what vs code automatically runs? when I type, 'python --version' it comes back as 2.7.
I'm looking in the command palette, but I'm not seeing python3. I'll keep looking around online, but any help would be wonderful.

Related

Mujoco in Ubuntu error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1

I was trying to install Mujoco in Ubuntu. I have downloaded mujoco200, and put it to ./mujoco with the license. Then downloaded mujoco_py with 'pip3 install mujoco_py==2.0.2.8'. According to the instructions I read online that should be all, and then when I run 'import mujoco_py', the following error shows:
distutils.errors.CompileError: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
Does anyone know how to solve this problem? If not, I am using Mac M1, does anyone know how else can I use Mujoco since I don't think I can use Mujoco in Mac M1?
At first, the terminal asks me to put 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/yilin/.mujoco/mujoco200/bin' in .bashrc, I did that and that bug is gone. But now this bug comes up. I have tried to use Mujoco with Mac, use mujoco_py in colab and both of them failed.
Any particular reason you want to use mujoco 2.0.0 rather than a later version of MuJoCo? mujoco_py supports the free MuJoCo since November last year (install mujoco_py==2.1.12.14).
Or better, avoid mujoco_py, and use the mujoco package on pip instead. If you're using Gym, read their note about the latest MuJoCo environments: https://github.com/openai/gym#mujoco-environments
Using mujoco rather than mujoco_py will avoid all installation problems, because the MuJoCo binary is included in that Python package and doesn't need to be installed separately. It works fine on Mac M1.

pip install psd-tools3 => FileNotFoundError: [Errno 2] No such file or directory

I was trying to install Ursina but I was having trouble getting all the required packages I needed to run my code properly. Come to find out, there's a package that refuses to install called 'psd-tools3' that won't install, no matter what I do.
I've been using cmd commands like 'pip install psd-tools3' and 'pip3 install psd-tools3' but no other commands work (i.e. 'sudo pip install psd-tools3' doesn't work because my PC doesn't know what 'sudo' means and doesn't run). I've tried installing required packages for this package, but nothing works. It just keeps giving me this error:
enter image description here
I would really appreciate the help with this problem. All I can really assume is that the Python file '_version' hasn't been created and that's what's throwing the whole program off. If there is a way to add this manually and then install it, I would appreciate steps to do that as well.
I was running this on a Lenovo Thinkpad (Windows 10) on Python 3.10 (I also have Python 3.8.3 but that was installed with the 3.10) and I made sure all packages and pip are up-to-date. Still having this problem and I don't know why.
Seems to me like the issue is on the side of the maintainers of psd-tools3.
For example, looking at the content of the latest source distribution on PyPI, we can see that it does not contain any _version.py file.
This needs to be solved by the project's maintainers, but they do not have a ticket tracker. On the other hand there seems to be an "Author" email address on the project's PyPI page as well as in the project's setup.py script.
A solution might be to clone the project's source code repository (with git), and try to install from the local clone.
Just simply try
pip install psd-tools3==1.9.0
Or
pip install psd-tools3==1.8.2
This should work on your pc as well. I was having same issue, and then I tried this It worked for me

I can’t get Kivy to work in Visual Studio

I’ve installed Kivy with Python and when I check the version it confirms that it’s there. But when I try to use files in VS, I get the message “kivy files require # kivy”.
I’ve searched for solutions to this but I can’t find anything.
Thanks
Thomas
I had a similar problem early on. What worked for me is as follows:
Going to Terminal or Command Prompt and typing
python3 -m pip install kivy
or
python3
then
>>> pip install kivy
I used another IDE called Mu Code (for Python) and tried it there. If it works for one application, it should work for all of them. Some other applications (like Mu) have a feature called the REPL, a read-evaluate-print-loop, that works like a python version of the terminal.
Also, be sure to check that you have correctly installed the latest version of Python. As of time of writing, the most current Python version is 3.10.5. You can download it from https://www.python.org/downloads/.
You can also try using the Python IDLE.
You can check if it's installed by using python3 -m kivy at the command line.
In the end, what worked for me was a lot of troubleshooting.
Hope that was helpful.

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

Can't get pip working with psychopy install

I am very new to python and plan to use psychopy quite a lot. I am on a work computer but have full admin rights.
Psychopy came with python version 2.7.11 and includes setuptools already.
I am trying to install the selenium module, but having trouble getting pip to work at all.
In cmd, it is recognising the 'python' command, so I know python is in my path.
I get the message "can't open file 'pip': [Errno2] No such file or directory" from:
python pip install selenium
I get " 'pip' is not recognised as an internal or external command" from:
pip install selenium
When I change directory to where pip is located, I get:
Fatal error in launcher: Unable to create process using '"'
Using pip2 makes no difference.
It seems a simple thing but where am I going wrong with this?!
I never really got to the bottom of this, but this is what I found out and here are the commands that worked for me in Windows. Be aware that I am far from expert!
To run python scripts (*.py) from command line (cmd) then C:\PsychoPy2 and C:\PsychoPy2\DLLs need to be in path. ('Path' contains directories or file extensions that can be more globally accessed, i.e. do not require you to change the prompt to the relevant directories first).
To check, open cmd and either type echo %PATH% or just type python. (If python starts, the line will say >>>. You can exit by typing quit())
To add to path, get properties of computer, then advanced system settings, then environment variables.
To check pip.exe (a sort of installation wizard) is installed, either search for the file, or check C:\PsychoPy2\Scripts for it. This may also need to be in path.
To reinstall the latest versions of pip and setup tools, I went to cmd and typed:
python -m pip install -U pip setuptools
If the same code did not work for other modules (which in my case was due to network access), then I downloaded the wheel file (*.whl) for that module (from their website) and ran the following code:
python -m pip install c:/modulename.whl
These may not be the correct ways of doing things, but they worked for me when I couldn't get other ways to work!
I've just had the exact same issue with the pip install, and a conflict with PsychoPy installations. I think it's because python automatically wants to call on the path that's been set by Psychopy, so it can't get to the 'pip' folders that for me, remain in a temporary/hidden file. This wasn't intuitive for me - on any machine without psychopy python just 'works' when you download it.

Resources