Cannot launch Anaconda-Navigator under Ubuntu system with error FileNotFound - python

I launch terminal and run anaconda-navigator I can see the green icon, however forever paused with the following details in the terminal
Traceback (most recent call last):
File "/home/jichao/anaconda3/lib/python3.8/site-packages/anaconda_navigator/widgets/main_window.py", line 550, in setup
self.post_setup(conda_data=conda_data)
File "/home/jichao/anaconda3/lib/python3.8/site-packages/anaconda_navigator/widgets/main_window.py", line 587, in post_setup
self.tab_home.setup(conda_data)
File "/home/jichao/anaconda3/lib/python3.8/site-packages/anaconda_navigator/widgets/tabs/home.py", line 171, in setup
self.set_applications(applications, packages)
File "/home/jichao/anaconda3/lib/python3.8/site-packages/anaconda_navigator/widgets/tabs/home.py", line 206, in set_applications
apps = self.api.process_apps(applications, prefix=self.current_prefix)
File "/home/jichao/anaconda3/lib/python3.8/site-packages/anaconda_navigator/api/anaconda_api.py", line 865, in process_apps
app = app(config=self.config, process_api=self._process_api)
File "/home/jichao/anaconda3/lib/python3.8/site-packages/anaconda_navigator/api/external_apps/pycharm.py", line 111, in __init__
super(PyCharmProApp, self).__init__(
File "/home/jichao/anaconda3/lib/python3.8/site-packages/anaconda_navigator/api/external_apps/pycharm.py", line 15, in __init__
super(BasePyCharmApp, self).__init__(
File "/home/jichao/anaconda3/lib/python3.8/site-packages/anaconda_navigator/api/external_apps/base.py", line 47, in __init__
self.set_up_app_directory_path()
File "/home/jichao/anaconda3/lib/python3.8/site-packages/anaconda_navigator/api/external_apps/base.py", line 59, in set_up_app_directory_path
self.app_directory_path = self._get_linux_installation_directory()
File "/home/jichao/anaconda3/lib/python3.8/site-packages/anaconda_navigator/api/external_apps/pycharm.py", line 62, in _get_linux_installation_directory
for dir_name in os.listdir(root):
FileNotFoundError: [Errno 2] No such file or directory: '/opt'

I checked to see if the opt folder was in the root directory. It was not. I opened terminal and typed:
cd /
sudo makedir opt
This appeared to solve the issue for me.

Related

Why does Virtual Studio code keep failing to fine file or directory in python

I run my code in Pythons build in IDLE Shell and it will run no problem. But once it is in virtual studio it then throws this error code.
I have gone into my Python Extension settings and have checked the 'Execute In File Dir' like multiple other posts and fixes say, but it does not seem to resolve my issue.
Error:
Traceback (most recent call last):
File "c:\Users\dpr48\OneDrive\Desktop\Python\FINAL PROJECT\Versions\v1.0.0\Cipher Text -
v1.0.0\CipherText-v1.0.0.py", line 27, in <module>
mainwindow = MainMenu()
File "c:\Users\dpr48\OneDrive\Desktop\Python\FINAL PROJECT\Versions\v1.0.0\Cipher Text -
v1.0.0\CipherText-v1.0.0.py", line 17, in __init__
loadUi('MainMenu.ui', 'r', self)
File "C:\Users\dpr48\AppData\Local\Programs\Python\Python39\lib\site-
packages\PyQt5\uic\__init__.py", line 238, in loadUi
return DynamicUILoader(package).loadUi(uifile, baseinstance, resource_suffix)
File "C:\Users\dpr48\AppData\Local\Programs\Python\Python39\lib\site-
packages\PyQt5\uic\Loader\loader.py", line 66, in loadUi
File "C:\Users\dpr48\AppData\Local\Programs\Python\Python39\lib\site-
packages\PyQt5\uic\uiparser.py", line 1020, in parse
document = parse(filename)
File "C:\Users\dpr48\AppData\Local\Programs\Python\Python39\lib\xml\etree\ElementTree.py",
line 1229, in parse
tree.parse(source, parser)
File "C:\Users\dpr48\AppData\Local\Programs\Python\Python39\lib\xml\etree\ElementTree.py",
line 569, in parse
source = open(source, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'MainMenu.ui'

pip3 error : AttributeError: module 'platform' has no attribute 'linux_distribution'? (ubuntu 20.04 with python 3.8)

I think i have messed up some python files when installing some packages in a requirement.txt file
now i get these errors when trying to install or uninstall anything:
for example when trying to uninstall matplotlib without sudo using pip3 uninstall matplotlib (even tho i never had to use sudo to uninstall anything before) :
Found existing installation: matplotlib 3.3.1
Uninstalling matplotlib-3.3.1:
Would remove:
/usr/local/lib/python3.8/dist-packages/matplotlib-3.3.1-py3.8-linux-x86_64.egg
Proceed (y/n)? y
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.8/shutil.py", line 788, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/matplotlib-3.3.1-py3.8-linux-x86_64.egg' -> '/tmp/pip-uninstall-nw393b36'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/john/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 228, in _main
status = self.run(options, args)
File "/home/john/.local/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py", line 89, in run
uninstall_pathset = req.uninstall(
File "/home/john/.local/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 686, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/home/john/.local/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 394, in remove
moved.stash(path)
File "/home/john/.local/lib/python3.8/site-packages/pip/_internal/req/req_uninstall.py", line 283, in stash
renames(path, new_path)
File "/home/john/.local/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 352, in renames
shutil.move(old, new)
File "/usr/lib/python3.8/shutil.py", line 800, in move
rmtree(src)
File "/usr/lib/python3.8/shutil.py", line 715, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.8/shutil.py", line 672, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.8/shutil.py", line 670, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'pylab.py'
When trying with sudo :
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/local/lib/python3.8/dist-packages/pip/commands/uninstall.py", line 46, in run
with self._build_session(options) as session:
File "/usr/local/lib/python3.8/dist-packages/pip/basecommand.py", line 66, in _build_session
session = PipSession(
File "/usr/local/lib/python3.8/dist-packages/pip/download.py", line 321, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.8/dist-packages/pip/download.py", line 93, in user_agent
zip(["name", "version", "id"], platform.linux_distribution()),
AttributeError: module 'platform' has no attribute 'linux_distribution'
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 33, in <module>
sys.exit(load_entry_point('pip==20.3.dev0', 'console_scripts', 'pip3')())
File "/usr/local/lib/python3.8/dist-packages/pip/__init__.py", line 217, in main
return command.main(cmd_args)
File "/usr/local/lib/python3.8/dist-packages/pip/basecommand.py", line 242, in main
with self._build_session(
File "/usr/local/lib/python3.8/dist-packages/pip/basecommand.py", line 66, in _build_session
session = PipSession(
File "/usr/local/lib/python3.8/dist-packages/pip/download.py", line 321, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.8/dist-packages/pip/download.py", line 93, in user_agent
zip(["name", "version", "id"], platform.linux_distribution()),
AttributeError: module 'platform' has no attribute 'linux_distribution'
How can i fix this? i am using ubuntu 20.04 and i heard uninstalling python3.8 is a big no no since many system files use it, so what should i do?
tried many suggestion on similar questions like this and it didn't work:
How to fix "module 'platform' has no attribute 'linux_distribution'" when installing new packages with Python3.8?
Python 3.8 removed some stuff. I solved my problems with pip (specifically pip install) by installing pip with curl
What worked for me was:
cd ~/Downloads
Downloading get-pip.py
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Then running it with python 3.8:
python3.8 get-pip.py
Solved it for me.

Pyinstaller "FileNotFoundError: [Errno 2] No such file or directory:" when running app

I recently have packaged a python app using the pyinstaller --onefile command. It succesfully makes a executable file that launches fine. I can use pretty much almost all the functions in my script with no problem, except one. When I call a function of another python file (which is in my app folder), I get this error:
Traceback (most recent call last):
File "socketserver.py", line 647, in process_request_thread
File "socketserver.py", line 357, in finish_request
File "socketserver.py", line 717, in __init__
File "http/server.py", line 426, in handle
File "http/server.py", line 414, in handle_one_request
File "CaptchaHarvester/harvester/server/__init__.py", line 134, in do_GET
File "CaptchaHarvester/harvester/server/__init__.py", line 178, in handel_request
File "CaptchaHarvester/harvester/server/__init__.py", line 85, in _load_template
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/rl/rmr5s0ld22j0h_z15m90v0c80000gr/T/_MEIBVnHEv/harvester/server/templates/ga.chunk.html'
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 54955)
Traceback (most recent call last):
File "socketserver.py", line 647, in process_request_thread
File "socketserver.py", line 357, in finish_request
File "socketserver.py", line 717, in __init__
File "http/server.py", line 426, in handle
File "http/server.py", line 414, in handle_one_request
File "CaptchaHarvester/harvester/server/__init__.py", line 122, in do_GET
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/rl/rmr5s0ld22j0h_z15m90v0c80000gr/T/_MEIBVnHEv/harvester/server/icon.png'
The problem seems to be that pyinstaller cant properly find the files(icon.png and ga.hunk.html). These files are in a folder that is in the same folder as my main.py file. I was wondering how I can make pyinstaller find these files succesfully? I have tried to add to the datas class in the .spec file, but I still get the error. This is what that line looks like:datas=[('/Users/A/Desktop/ss/CaptchaHarvester/harvester/server/icon.png','/Users/A/Desktop/ss/CaptchaHarvester/harvester/server')],
Please let me know if I am doing something wrong or if yall have any ideas on how to resolve it.
I am on macosx catalina and python 3.7 if that is any help.
Thanks!
You can use arguments in command prompt to ensure the correct filesare found by pyinstaller; --add-data "path_to_file:path_in_executable in directory" an example would be
pyinstaller --add-data "icon.png;." --onefile socketserver.py
here icon.png is in the same directoy of socketserver.py and is copied to the root directory of the executable (the . signifies root directory)

Error when trying repo init on external drive on Ubuntu

I'm trying to init repo of Android ROM, but it returns following error on Ubuntu 16.04:
$ repo init -u git://github.com/AOSiP/platform_manifest.git -b pie
Get git://github.com/AOSiP/platform_manifest.git
Traceback (most recent call last):
File "/media/exthdd/AOSIP/.repo/repo/main.py", line 547, in <module>
_Main(sys.argv[1:])
File "/media/exthdd/AOSIP/.repo/repo/main.py", line 522, in _Main
result = repo._Run(argv) or 0
File "/media/exthdd/AOSIP/.repo/repo/main.py", line 184, in _Run
result = cmd.Execute(copts, cargs)
File "/media/exthdd/AOSIP/.repo/repo/subcmds/init.py", line 426, in Execute
self._SyncManifest(opt)
File "/media/exthdd/AOSIP/.repo/repo/subcmds/init.py", line 188, in _SyncManifest
m._InitGitDir(mirror_git=mirrored_manifest_git)
File "/media/exthdd/AOSIP/.repo/repo/project.py", line 2395, in _InitGitDir
self._UpdateHooks()
File "/media/exthdd/AOSIP/.repo/repo/project.py", line 2416, in _UpdateHooks
self._InitHooks()
File "/media/exthdd/AOSIP/.repo/repo/project.py", line 2446, in _InitHooks
os.path.relpath(stock_hook, os.path.dirname(dst)), dst)
File "/media/exthdd/AOSIP/.repo/repo/platform_utils.py", line 195, in symlink
return os.symlink(source, link_name)
OSError: [Errno 38] Function not implemented
It works when running on system drive, but I don't have enough space there.
Drive had exFAT filesystem, error gone on ext4.

Google AppEngine Python OSError "too many files open" at launch

I'm using ubuntu 13.10 running in a VM on OSX, python2.7 and GAE 1.8.8.
Lauching dev_appserver.py results in the following error:
INFO 2013-12-10 03:53:30,046 api_server.py:527] Saving search indexes
Traceback (most recent call last):
File "/home/ubuntu/xxxxxx/google_appengine/dev_appserver.py", line 197, in <module>
File "/home/ubuntu/xxxxxx/google_appengine/dev_appserver.py", line 193, in _run_file
File "/home/ubuntu/xxxxxx/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 872, in <module>
File "/home/ubuntu/xxxxxx/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 868, in main
File "/home/ubuntu/xxxxxx/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 707, in stop
File "/home/ubuntu/xxxxxx/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 141, in quit
File "/home/ubuntu/xxxxxx/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 528, in cleanup_stubs
File "/home/ubuntu/xxxxxx/google_appengine/google/appengine/api/search/simple_search_stub.py", line 984, in Write
File "/usr/lib/python2.7/tempfile.py", line 304, in mkstemp
File "/usr/lib/python2.7/tempfile.py", line 239, in _mkstemp_inner
OSError: [Errno 24] Too many open files: '/tmp/appengine.xxxxxx-hr-dev.ubuntu/tmpMVVXrH'
Any ideas?
Check the shared memory parameter, kern.sysv.shmseg on your linux system and set it right by increasing it.
To view the shared memory parameters, use:
sysctl -A | grep shm
To update that parameters, edit file:
sudo nano /etc/sysctl.conf
Refer to this SO answer for more information.

Categories

Resources